@teakit/month

Use this skill when writing code for @teakit/month.

@teakit/month exports Month, an immutable year-month calculation API for ESM and browser environments.

Core Rules

  1. Import with import { Month } from "@teakit/month".
  2. Do not use default imports from @teakit/month.
  3. Create values with Month.from(...); do not use new Month(...) or call Month(...).
  4. Prefer canonical YYYY-MM strings for normal years, such as "2025-01".
  5. Use add(months) and sub(months) for month offsets.
  6. Use diff(other) or Month.diff(left, right) for signed month differences.
  7. Use Month methods instead of JavaScript Date arithmetic.
  8. Treat Month instances as immutable. Do not mutate year, month, or index.
  9. Use toString() or JSON serialization for canonical string output.

Workflow

  1. Identify the operation: creation, month offsets, differences, comparison, ranges, or conversion.
  2. Load only the relevant method reference file from references/.
  3. In that file, read the intro, examples, API Reference, Agent Contract, and Agent Notes.
  4. Prefer Month.from(...), exact strings, and Month instance methods in generated code.
  5. For repository changes, run the local verification commands when relevant: bun run check, bun run typecheck, bun run test, and bun run build.
  6. For documentation site changes, also run bun run docs:build.

Quick Example

import { Month } from "@teakit/month";

const renewal = Month.from("2025-01").add(12);
renewal.toString(); // "2026-01"

Reference Selection

Read the smallest method file that answers the current task.

NeedRead
Create month valuesfrom
Add or subtract offsetsadd/sub
Count months between valuesdiff
Compare or sort valuescomparison
Generate month sequencesrange