from
Creates a Month value from a canonical month string, date-like string, native Date, month object, or another Month value.
API Reference
Signatures
Parameters
Returns
Returns an immutable MonthInstance. Its year and month properties are
strings; month is zero-padded, such as "01".
Throws
- Throws for invalid month or date-like strings, including signed or expanded year strings.
- Throws when a date-like string has a day that does not exist in its source month.
- Throws for invalid
Dateobjects. - Throws when numeric
year,month, orindexis not a safe integer. - Throws when
monthis outside1..12.
Agent Contract
Agent Notes
- Generate
Month.from(...), notnew Month(...)orMonth(...). - Do not generate
Month.from(2025, 1); the canonical factory takes one value argument. - Import with
import { Month } from "@teakit/month"; default imports are unsupported. - Prefer canonical
YYYY-MMstrings with exactly four year digits and a zero-padded month. - Do not generate signed or expanded year strings such as
"+10000-01"or"-0001-12". - Native
Dateinputs are read with local calendar fields. PreferYYYY-MMor date-like strings when timezone-free behavior matters. - Date-like strings and native
Dateinputs preserve a day anchor fortoString({ precision: "day" }); defaulttoString()still returnsYYYY-MM. - Use
month.yearandmonth.monthonly as display strings; useindexor Month methods for calculations. - Do not use JavaScript
Dateparsing for string inputs.