@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
15 lines (14 loc) • 667 B
TypeScript
/**
* Resolve a timezone string for the Unix/UTC formatters.
*
* - `"local"` → the system timezone via `getSystemTimeZone()`.
* - A valid IANA timezone identifier → returned as-is.
* - Anything else (undefined, empty, invalid name, typo) → `"UTC"`.
*
* The UTC fallback is intentional: `formatUnix` / `formatUtc` / the relative
* formatters expose `timeZone` as an *optional* convenience, so we degrade
* gracefully when callers pass nothing or pass a typo. Callers that need
* strict timezone validation should use `isValidTimeZone()` themselves
* before calling these formatters.
*/
export declare function normalizeTimeZone(tz?: string): string;