addMonths
The addMonths() function adds a positive number of months to a TheDate. Year rollovers and leap years are handled automatically.
Interactive example
Syntax
Classic signature
typescript
function addMonths<
GenericInput extends TheDate,
GenericMonth extends number
>(
input: GenericInput,
month: PositiveNumber<GenericMonth>
): TheDateCurried signature
typescript
function addMonths<
GenericInput extends TheDate,
GenericMonth extends number
>(
month: PositiveNumber<GenericMonth>
): (input: GenericInput) => TheDateParameters
month: Strictly positive number of months.input: Date to adjust (classic signature).
Return value
A TheDate moved forward by the given number of months.
