Skip to main content

Function: fromISO()

fromISO(iso): CalendarDate

Defined in: src/lib/dates/index.ts:70

Parse an ISO YYYY-MM-DD string into a CalendarDate. Strictly format-checked: requires exactly four digit year, two digit month, two digit day separated by hyphens — no time component, no timezone offset, no shorthand. The parsed values are then range-validated via makeDate.

Parameters

iso

string

A calendar date string in YYYY-MM-DD form.

Returns

CalendarDate

The corresponding validated CalendarDate.

Throws

DateError if the string does not match YYYY-MM-DD, or if the parsed month/day are out of range.