Skip to content

isValidDate

  • The core functions, which every industry uses.
isValidDate(value: string): boolean
isValidDate(value: void | {} | null | undefined): boolean
isValidDate(value: unknown): value is string

Return 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]) returns false. isValidCalendarDate is 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 String object included, returns false. A true result narrows an unknown value to string.
ParameterTypeDescription
valuestringany value; a string is checked as an ISO PlainDate

boolean indicating validity

import { isValidDate } from "@northguild/gmt/plain/validate";
isValidDate("2024-03-10") // true
output 

plain/validate/isValidDate.ts

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.