toString
Renders the month as a string. The default and all implicit conversions
(valueOf, toJSON, template strings, String(...)) stay at month precision
(YYYY-MM). Pass precision to render year, month, or day explicitly.
API Reference
Signature
Parameters
Returns
Returns the canonical string for the requested precision: "YYYY", "YYYY-MM",
or "YYYY-MM-DD".
Throws
- Throws on
precision: "day"when the month has no day anchor. - Throws on any unsupported
precisionvalue.
Agent Contract
Agent Notes
- Default
toString()andvalueOf/toJSON/template strings always stay atYYYY-MM; only an explicitprecisionchanges that. - Day precision requires a day anchor from a date-shaped string or native
Dateinput, and clamps to the target month's last valid day. - The day anchor is hidden internal state; it never appears in toObject output.