isValidDate
Signature
Section titled “Signature”isValidDate(value: string): booleanReturn true if value is a valid ISO PlainDate string.
- The part before the first annotation must match
plainDate(a date, not a date-time). - Reads RFC 9557 annotations as
Temporal.PlainDate.fromdoes: elective ones ([foo=bar]) and a time zone annotation are ignored, and an unknown critical one ([!foo=bar]) is rejected. The calendar must be ISO ([u-ca=iso8601]is accepted); a non-ISO calendar isisValidCalendarDate’s input. - Rejects leap seconds (e.g., “2024-12-31T23:59:60”).
- Rejects invalid dates (e.g., “2024-02-30”).
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | ISO PlainDate string |
Returns
Section titled “Returns”boolean indicating validity
Examples
Section titled “Examples”import { isValidDate } from "@northguild/gmt/plain/validate";
isValidDate("2024-03-10") // true