isValidCalendarZonedDateTime
Signature
Section titled “Signature”isValidCalendarZonedDateTime(value: string): booleanisValidCalendarZonedDateTime(value: void | {} | null | undefined): booleanisValidCalendarZonedDateTime(value: unknown): value is stringReturn true if value is a valid GMT ZonedDateTime string: a bare ISO zoned datetime (“2024-10-03T14:30:45+02:00[Africa/Johannesburg]”) or an RFC 9557 calendar-annotated one (“2024-10-03T14:30:45+02:00[Africa/Johannesburg][u-ca=hebrew]”), as Temporal.ZonedDateTime#toString() and convertZonedToCalendar write it.
- Parallel to
isValidZonedDateTime, which accepts no calendar annotation. Only the calendar-awarezoned/functions gate on this validator, so a string is never certified by a validator whose own namespace refuses it. - The calendar annotation follows the time zone annotation (RFC 9557 §4.1); a calendar before the zone, which Temporal also rejects, returns false.
- A
[u-ca=<id>]annotation, optionally critical. Temporal’sCanonicalizeCalendarvalidates the id (folding case and aliases), and the calendar must be one GMT supports (CalendarSystem). - At most one annotation beyond the zone, the
u-caone, after the zone. An elective or unknown critical annotation ([foo=bar],[!foo=bar]) and a secondu-caannotation return false. - The part before the zone must be ISO 8601 extended format, as
isValidZonedDateTimerequires: basic format, a space or lower-casetseparator, a lower-casez, an hour-only time or offset and a date without a time return false. - Rejects leap seconds, which
Temporal.ZonedDateTime.fromotherwise clamps to:59. - Delegates the date, time, offset, zone and annotation checks to
Temporal.ZonedDateTime.from(viaparseCalendarZonedValue). - Returns false for an empty string.
- A value that is not a string, a
Stringobject included, returnsfalse. Atrueresult narrows anunknownvalue tostring. Compatibility: since 1.16.0 the string is RFC 9557. Earlier releases accepted calendar-native digits,;era=, the calendar annotation before the zone, and the idsgregorian,taiwan,islamic-tabularandethiopic-amete-alem.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | any value; a string is checked as a zoned datetime, optionally calendar-annotated |
Returns
Section titled “Returns”boolean indicating validity
Examples
Section titled “Examples”import { isValidCalendarZonedDateTime } from "@northguild/gmt/zoned/validate";
isValidCalendarZonedDateTime("2024-10-03T14:30:45+02:00[Africa/Johannesburg]") // 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.