Skip to content

areZonedEqual

areZonedEqual(value1: string, value2: string): boolean

Compare two zoned datetime strings for exact local-field equality.

  • Inputs must be valid ISO 8601 zoned datetime strings.
  • Returns true when year/month/day/hour/minute/second/millisecond/microsecond/nanosecond and IANA timeZone id all match; otherwise false.
  • Invalid inputs return false.
ParameterTypeDescription
value1stringfirst zoned datetime string
value2stringsecond zoned datetime string

boolean indicating whether the two zoned datetimes are equal

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