Skip to content

isValidCalendarDate

isValidCalendarDate(value: string): boolean
import { isValidCalendarDate } from "@northguild/gmt/plain/validate";

Return true if value is a valid GMT PlainDate string: a plain ISO date

  • (“2024-10-03”) or a calendar-annotated date with calendar-native fields (“5785-01-01[u-ca=hebrew]”), as produced by convertDateToCalendar.
  • Delegates all field-range and calendar-identifier checking to Temporal.PlainDate.from (via parseCalendarDateValue).
Parameter Type Description
value string ISO PlainDate string, optionally calendar-annotated

boolean indicating validity

isValidCalendarDate("2024-10-03") // true
isValidCalendarDate("5785-01-01[u-ca=hebrew]") // true
isValidCalendarDate("2024-10-03[u-ca=martian]") // false (unknown calendar identifier)
isValidCalendarDate("invalid") // false

plain/validate/isValidCalendarDate.ts