Skip to content

isValidZonedInterval

  • The core functions, which every industry uses.
isValidZonedInterval(start: string, end: string): boolean

Return true if start and end form a valid zoned interval — both valid ISO ZonedDateTime strings (isValidZonedDateTime) and the instant at start is <= the instant at end.

  • Both inputs must be valid ISO 8601 zoned datetime strings.
  • Equal start === end is valid.
  • Comparison is done by instant, so intervals spanning DST transitions are compared by absolute time.
  • Reads each endpoint as isValidZonedDateTime does: the zone bracket is the only annotation, and a calendar ([u-ca=iso8601], [u-ca=hebrew]) or an elective one ([foo=bar]) returns false. isValidCalendarZonedInterval reads the calendar.
  • Invalid input, malformed strings, or leap-second strings return false.
ParameterTypeDescription
startstringISO ZonedDateTime string (interval start)
endstringISO ZonedDateTime string (interval end)

true if start and end form a valid zoned interval, or false on invalid input

import { isValidZonedInterval } from "@northguild/gmt/zoned/interval";
isValidZonedInterval("2024-01-01T10:00:00+00:00[UTC]", "2024-12-31T23:59:59+00:00[UTC]") // true
output 

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