isValidIsoDateLike
Signature
Section titled “Signature”isValidIsoDateLike(value: string): booleanReturn true when the input is a valid PlainDate or PlainDateTime ISO string.
- Accepts both PlainDate (“2024-02-29”) and PlainDateTime (“2024-02-29T12:34:56”) formats.
- The part before the first annotation must match
plainDateorplainDateTime. - Reads RFC 9557 annotations as
Temporal.PlainDate.from/Temporal.PlainDateTime.fromdo: elective ones and a time zone annotation are ignored, an unknown critical one is rejected, and the calendar must be ISO. - Rejects leap seconds and invalid dates/times.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | ISO PlainDate or PlainDateTime string |
Returns
Section titled “Returns”boolean indicating validity
Examples
Section titled “Examples”import { isValidIsoDateLike } from "@northguild/gmt/plain/validate";
isValidIsoDateLike("2024-02-29") // true