Skip to content

chopZonedDateTime

chopZonedDateTime(value: string): string
import { chopZonedDateTime } from "@northguild/gmt/zoned/chop";

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

  • Extracts timezone id from a ZonedDateTime.
  • Returns “” for invalid input.
Parameter Type Description
value string ISO 8601 zoned datetime string

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

chopZonedDateTime("2024-02-29T12:30:45+01:00[Europe/Paris]") // "Europe/Paris"
chopZonedDateTime("invalid") // ""

zoned/chop/chopZonedDateTime.ts