Skip to content

isValidZonedDateTime

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

Validate whether a string is a valid ISO 8601 zoned datetime string.

  • The part before the first annotation must be ISO 8601 extended format: <date>T<time>, then nothing, Z, or a ±HH:MM[:SS[.fraction]] offset. Basic format (20241003T143000-0400), a space or lower-case t separator, a lower-case z, an hour-only time or offset, and a date without a time are rejected, although Temporal.ZonedDateTime.from reads them.
  • Uses Temporal.ZonedDateTime.from for validation.
  • A written offset must agree with the bracketed zone, as TC39 ToTemporalZonedDateTime matches it: an offset written to the minute may be the zone’s sub-minute offset rounded (-00:45[Africa/Monrovia] for −00:44:30, which is how Temporal writes it), and an offset written with seconds must be the zone’s offset exactly.
  • Rejects leap seconds.
  • With an offset, the local date must be inside Temporal’s date range, as Temporal.ZonedDateTime.from requires (CheckISODaysRange): a zoned string on −271821-04-19, which a zone west of Greenwich shows for the first hours of the instant range, is rejected although isValidInstant accepts it.
  • The zone bracket is the only annotation: a calendar ([u-ca=iso8601], [u-ca=hebrew]), an elective one ([foo=bar]), an unknown critical one or a second bracket returns false. isValidCalendarZonedDateTime reads the calendar.
  • Returns false for an empty string.
  • 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 8601 zoned datetime

boolean indicating validity

import { isValidZonedDateTime } from "@northguild/gmt/zoned/validate";
isValidZonedDateTime("2024-02-29T12:34:56.789+00:00[UTC]") // true
output 

zoned/validate/isValidZonedDateTime.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.