areZonedEqual
Signature
Section titled “Signature”areZonedEqual(value1: string, value2: string): booleanCompare two zoned datetime strings the way Temporal’s ZonedDateTime.prototype.equals does.
- Inputs must be valid ISO 8601 zoned datetime strings.
- Returns
truewhen both values are the same instant (equal epoch nanoseconds), are in the same time zone and use the same calendar; otherwisefalse. - The offset in the string is part of the instant, so the two passes of a repeated wall clock (
02:30+02:00and02:30+01:00on Berlin’s 2024-10-27 fall-back) are different values. - Two identifiers of one time zone are one time zone (Temporal TimeZoneEquals):
UTC,Etc/UTCandGMT, and identifiers that differ only in letter case, on every host. An IANA link such asEurope/KievandEurope/Kyivis one zone where the host resolves it; Safari 27 withoutTemporalkeeps 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
iso8601reaches 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
isBeforeZonedandisAfterZoned. - Invalid inputs return
false.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value1 | string | first zoned datetime string |
value2 | string | second zoned datetime string |
Returns
Section titled “Returns”true when the two zoned datetimes are equal; false when they differ or either input is invalid
Examples
Section titled “Examples”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]") // 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.