Skip to content

maxZoned

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

Return the latest (maximum) 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 latest zoned datetime string, or null on invalid input

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

zoned/calculate/maxZoned.ts