getZonedOffset
Signature
Section titled “Signature”getZonedOffset(value: string): stringimport { getZonedOffset } from "@northguild/gmt/zoned/parse";Extract the UTC offset from an ISO 8601 zoned datetime string.
- Returns the offset in Temporal’s ±HH:MM string form.
- This is a value-taking accessor (per J0b’s
get/rule), so it lives inparse/alongsideparseTimeZoneFromZoned, notget/. - Returns “” for invalid input.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value |
string |
zoned ISO 8601 datetime string |
Returns
Section titled “Returns”offset string (e.g. “-04:00”), or “” on invalid input
Related types
Section titled “Related types”Examples
Section titled “Examples”getZonedOffset("2024-02-29T12:34:56.789+00:00[UTC]") // "+00:00"getZonedOffset("2024-07-15T12:00:00-04:00[America/New_York]") // "-04:00"getZonedOffset("2024-05-15T12:00:00+05:45[Asia/Kathmandu]") // "+05:45"getZonedOffset("invalid") // ""