Skip to content

sortZoned

  • The core functions, which every industry uses.
sortZoned(zonedDateTimes: string[], order?: "asc" | "desc"): string[]

Sort an array of ZonedDateTime values in ascending or descending order.

  • Invalid dates are filtered out.
  • Defaults to ascending order (earliest first).
  • Returns empty array if no valid dates.
ParameterTypeDescription
zonedDateTimesstring[]Array of ISO ZonedDateTime strings
order"asc" | "desc"“asc” for ascending (earliest first) | “desc” for descending (latest first)

Sorted array of zoned datetime strings

import { sortZoned } from "@northguild/gmt/zoned/calculate";
sortZoned(["2024-03-10T12:00:00[Australia/Sydney]", "2024-01-01T08:00:00[Australia/Sydney]", "2024-02-15T15:30:00[Australia/Sydney]"]) // ["2024-01-01T08:00:00+11:00[Australia/Sydney]", "2024-02-15T15:30:00+11:00[Australia/Sydney]", "2024-03-10T12:00:00+11:00[Australia/Sydney]"]
zonedDateTimes
output 

zoned/calculate/sortZoned.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.