Skip to content

chopZonedDateTime

chopZonedDateTime(value: string): string

Extracts the IANA timeZone identifier from an ISO 8601 zoned datetime string.

  • Extracts timezone id from a ZonedDateTime.
  • Returns "" for invalid input.
ParameterTypeDescription
valuestringISO 8601 zoned datetime string

IANA timeZone id (e.g. Europe/Paris) or "" for invalid

import { chopZonedDateTime } from "@northguild/gmt/zoned/chop";
chopZonedDateTime("2024-02-29T12:30:45+01:00[Europe/Paris]") // "Europe/Paris"
output 

zoned/chop/chopZonedDateTime.ts