Skip to content

minZoned

minZoned(zonedDateTimes: string[]): string
import { minZoned } from "@northguild/gmt/zoned/calculate";

Return the earliest (minimum) of the given ZonedDateTime values.

  • Returns null if the array is empty or contains no valid dates.
  • Validation is performed on each item in the array.
Parameter Type Description
zonedDateTimes string[] Array of ISO ZonedDateTime strings

The earliest zoned datetime string, or null on invalid input

minZoned(["2024-03-10T12:00:00[America/New_York]", "2024-03-15T12:00:00[America/New_York]"]) // "2024-03-10T12:00:00-05:00[America/New_York]"
minZoned(["invalid", "2024-03-15T12:00:00[America/New_York]"]) // "2024-03-15T12:00:00-04:00[America/New_York]"
minZoned(["invalid", "also invalid"]) // null
minZoned([]) // null

zoned/calculate/minZoned.ts