Skip to content

areZonedEqual

  • The core functions, which every industry uses.
areZonedEqual(value1: string, value2: string): boolean

Compare two zoned datetime strings the way Temporal’s ZonedDateTime.prototype.equals does.

  • Inputs must be valid ISO 8601 zoned datetime strings.
  • Returns true when both values are the same instant (equal epoch nanoseconds), are in the same time zone and use the same calendar; otherwise false.
  • The offset in the string is part of the instant, so the two passes of a repeated wall clock (02:30+02:00 and 02:30+01:00 on Berlin’s 2024-10-27 fall-back) are different values.
  • Two identifiers of one time zone are one time zone (Temporal TimeZoneEquals): UTC, Etc/UTC and GMT, and identifiers that differ only in letter case, on every host. An IANA link such as Europe/Kiev and Europe/Kyiv is one zone where the host resolves it; Safari 27 without Temporal keeps the two names as written. An offset zone ([+05:30]) equals only the same offset zone, never a named zone.
  • The calendar is compared too, but only iso8601 reaches it: a non-ISO calendar annotation is invalid input.
  • The same instant written in two different zones is not equal; compare instants across zones with isBeforeZoned and isAfterZoned.
  • Invalid inputs return false.
ParameterTypeDescription
value1stringfirst zoned datetime string
value2stringsecond zoned datetime string

true when the two zoned datetimes are equal; false when they differ or either input is invalid

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

zoned/compare/areZonedEqual.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.