getZonedNowUnit
Signature
Section titled “Signature”getZonedNowUnit(ianaTimezone: string, unit: ZonedNowUnit): stringimport { getZonedNowUnit } from "@northguild/gmt/zoned/get";Return the requested current unit value for the specified IANA timeZone.
- Uses Temporal.Now.zonedDateTimeISO to get the current time.
- Uses weekOfYear helper for week calculations.
- Validation is performed on timezone and unit.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
ianaTimezone |
string |
IANA timeZone identifier |
unit |
ZonedNowUnit |
unit to extract from current zoned time |
Returns
Section titled “Returns”string representation of the requested unit or “” on invalid input
Related types
Section titled “Related types”Examples
Section titled “Examples”getZonedNowUnit("America/New_York", "hour") // "07"getZonedNowUnit("invalid", "hour") // ""