Skip to content

isValidUtcInterval

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

Return true if start and end form a valid UTC interval — both parseable as ISO UTC datetime strings and the instant at start is <= the instant at end.

  • Both inputs must be ISO 8601 UTC datetime strings (e.g. "2024-01-01T10:00:00Z").
  • Equal start === end is valid.
  • Leap-second strings return false.
  • Invalid input or malformed strings return false.
  • Each endpoint must satisfy isValidUtc, so an annotation of any kind (a time zone, a calendar, an elective one) returns false.
ParameterTypeDescription
startstringISO 8601 UTC datetime string (interval start)
endstringISO 8601 UTC datetime string (interval end)

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

import { isValidUtcInterval } from "@northguild/gmt/utc/interval";
isValidUtcInterval("2024-01-01T10:00:00Z", "2024-12-31T23:59:59Z") // true
output 

utc/interval/validate/isValidUtcInterval.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.