@teakit/month

@teakit/month is a TypeScript year-month calculation package for ESM and browser environments.

Guide

Use this page as the short human entrypoint. Keep detailed API behavior in the method reference pages.

NeedRead
Install and try the packageInstallation & Usage
Find a method by taskReference Map
Compact rules for AI agentsLLMs
Skill instructions for agent runtimesSkill Instructions

Installation & Usage

npm
yarn
pnpm
bun
deno
npm install @teakit/month
import { Month } from "@teakit/month";

const current = Month.from("2025-01");
const nextQuarter = current.add(3);

nextQuarter.toString(); // "2025-04"
Month.range("2025-01", "2025-03").map(String); // ["2025-01", "2025-02", "2025-03"]

Always create values with Month.from(...). Use diff for month differences and add or sub for month offsets.

Package Contract

  • Import Month from @teakit/month.
  • Create values with Month.from(...); do not use new Month(...) or call Month(...).
  • Use canonical YYYY-MM strings for normal years.
  • Treat Month instances as immutable.
  • Use Month methods instead of JavaScript date arithmetic.
  • The package is browser-safe ESM and has no Node runtime imports.

Reference Map

TaskMethods
Constructionfrom, fromIndex
Month offsetsadd/sub
Differencesdiff
Rangesrange
Comparisoncomparison
ConversiontoString, toJSON, toObject, valueOf

LLMs

AI agents should start with LLMs, then open only the relevant method reference file. Reference pages keep human usage first and AI-specific contracts near the end.