Skip to content

getZonedHour

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

Return the current hour 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 hour string (zero-padded to 2 digits) or “” on invalid input

getZonedHour("America/New_York") // "19"
getZonedHour("invalid") // ""

zoned/get/getZonedHour.ts