UNPKG

@burglekitt/gmt

Version:

Temporal-based date and time utilities with timezone support and polyfill integration

17 lines (16 loc) 804 B
export type ZonedNowUnit = "year" | "month" | "week" | "day" | "dayOfWeek" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"; /** * 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. * * @param ianaTimezone IANA timeZone identifier * @param unit unit to extract from current zoned time * @returns string representation of the requested unit or "" on invalid input * * @example getZonedNowUnit("America/New_York", "hour") // "07" * @example getZonedNowUnit("invalid", "hour") // "" */ export declare function getZonedNowUnit(ianaTimezone: string, unit: ZonedNowUnit): string;