Skip to content

@jsvision/ui / parseISO

Function: parseISO()

parseISO(str): CalendarDate | null

Defined in: ui/src/date/calendar-date.ts:192

Parse "YYYY-MM-DD" into a range-validated CalendarDate, or null on any malformed or out-of-range input (wrong shape, month outside 1-12, or day outside the month's length). Never throws and never yields an invalid date.

Parameters

str

string

The candidate string.

Returns

CalendarDate | null

A valid CalendarDate, or null.

Example

ts
parseISO('2026-07-08'); // { year: 2026, month: 7, day: 8 }
parseISO('2026-02-30'); // null (out of range)
parseISO('nope');       // null