add
Adds an integer month offset and returns a new Month value. A negative offset
moves backward, so add(-1) is equivalent to sub(1).
API Reference
Signatures
Parameters
Returns
Returns a new immutable MonthInstance.
If the source value has a day anchor from a date-like string or native Date,
add preserves that anchor for explicit day-precision output. Month calculation
still uses only the month index.
Throws
Throws when months is not a safe integer.
Agent Contract
Agent Notes
- Use a negative offset (
add(-1)) or sub to move backward. - Use diff for month differences between two values; do not overload
addwith another month value. - Do not use
Date#setMonth, because@teakit/monthis month-only and timezone-free. - Use
toString({ precision: "day" })only for output that needs the preserved day anchor; defaulttoString()remainsYYYY-MM.