convertUtcToZoned
Signature
Section titled “Signature”convertUtcToZoned(value: string, timeZone: string): stringimport { convertUtcToZoned } from "@northguild/gmt/utc/convert";Convert a UTC Instant string to a zoned ISO 8601 datetime string.
- Uses Temporal.Instant.from to parse, converts to specified timezone.
- Validates both UTC input and timezone.
- Returns “” for invalid input.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value |
string |
UTC Instant string |
timeZone |
string |
IANA timeZone identifier |
Returns
Section titled “Returns”zoned ISO 8601 string or “” on invalid
Examples
Section titled “Examples”convertUtcToZoned("2024-02-29T00:00:00Z", "America/New_York") // "2024-02-28T19:00:00-05:00[America/New_York]"convertUtcToZoned("invalid", "UTC") // ""