Skip to content

getZonedYear

getZonedYear(ianaTimezone: string): string
import { getZonedYear } from "@northguild/gmt/zoned/get";

Return the current year for the specified IANA timeZone.

  • Uses Temporal.Now.zonedDateTimeISO to get the current time.
  • Validation is performed on the timezone.
Parameter Type Description
ianaTimezone string IANA timeZone identifier

current year string (zero-padded to 4 digits) or “” on invalid input

getZonedYear("America/New_York") // "2024"
getZonedYear("invalid") // ""

zoned/get/getZonedYear.ts