isValidDate
Signature
Section titled “Signature”isValidDate(value: string): booleanisValidDate(value: void | {} | null | undefined): booleanisValidDate(value: unknown): value is stringReturn true if value is a valid ISO PlainDate string.
- The whole string must match
plainDate(a date, not a date-time). - Accepts no annotation of any kind: a time zone (
[Europe/Paris]), a calendar ([u-ca=iso8601],[u-ca=hebrew]) or an elective one ([foo=bar]) returnsfalse.isValidCalendarDateis the validator that reads a calendar. - Rejects leap seconds (e.g., “2024-12-31T23:59:60”).
- Rejects invalid dates (e.g., “2024-02-30”).
- A value that is not a string, a
Stringobject included, returnsfalse. Atrueresult narrows anunknownvalue tostring.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | any value; a string is checked as an ISO PlainDate |
Returns
Section titled “Returns”boolean indicating validity
Examples
Section titled “Examples”import { isValidDate } from "@northguild/gmt/plain/validate";
isValidDate("2024-03-10") // trueSource
Section titled “Source”Accessibility
© 2026 NorthGuild · Licences
Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else: © 2026 NorthGuild, all rights reserved.