getZonedNow
Signature
Section titled “Signature”getZonedNow(ianaTimezone: string, optionsArg?: { smallestUnit?: Temporal.ZonedDateTimeToStringOptions; }): stringimport { getZonedNow } from "@northguild/gmt/zoned/get";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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
ianaTimezone |
string |
IANA timeZone identifier |
Options
Section titled “Options”options
| Option | Type | Default |
|---|---|---|
smallestUnit? |
Temporal.ZonedDateTimeToStringOptions |
— |
Returns
Section titled “Returns”zoned ISO 8601 datetime string or “” on invalid input
Examples
Section titled “Examples”getZonedNow("America/New_York") // "2024-02-29T09:30:45.123-05:00[America/New_York]"getZonedNow("Invalid/Zone") // ""