# addMonths ends on the last day of the target month when that month is too short for the start date's day, in either direction: January 31 plus one month is February 29 in a leap year and February 28 otherwise. The time of day is kept.

> For agents: the index is https://myr.technology/llms.txt, and everything beyond it (refusals, git, landings, events, guides) is https://myr.technology/llms-full.txt; this project's index is https://myr.technology/oscabriel/datekit/llms.txt.

Ask `add-months-clamp` in oscabriel/datekit, a `fix` ask from ines-v.

## Territory

The paths `src/add.ts`, `test/add.test.ts`.

## Current

addMonths runs over into the next month: January 31 plus one month is March 2 in a leap year and March 3 otherwise.

## Check

`test/asks/add-months-clamp.test.ts` fails on main by an assertion; it passes once answered.

## Out of scope

- addDays and addWeeks, which count exact days
- diffInCalendarMonths

## Context

- addYears adds twelve months, so it follows: February 29 plus a year becomes February 28.
