sub
Subtracts an integer month offset and returns a new Month value. A negative
offset moves forward, so sub(-1) is equivalent to add(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,
sub 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 diff for month differences between two values; do not overload
subwith 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.