UNPKG

@burglekitt/gmt

Version:

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

18 lines (17 loc) 766 B
import { Temporal } from "@js-temporal/polyfill"; /** * Return the current zoned datetime for the specified IANA timeZone. * * - Uses Temporal.Now.zonedDateTimeISO to get the current time. * - Validation is performed on the timezone. * * @param ianaTimezone IANA timeZone identifier * @param optionsArg optional: smallestUnit ("second" | "millisecond" | "microsecond" | "nanosecond") * @returns zoned ISO 8601 datetime string or "" on invalid input * * @example getZonedNow("America/New_York") // "2024-02-29T09:30:45.123-05:00[America/New_York]" * @example getZonedNow("Invalid/Zone") // "" */ export declare function getZonedNow(ianaTimezone: string, optionsArg?: { smallestUnit?: Temporal.ZonedDateTimeToStringOptions["smallestUnit"]; }): string;