UNPKG

1.25 kBTypeScriptView Raw
1import type { TimezoneWithNames } from "./timezoneTypes";
2export declare const TimezoneDisplayFormat: {
3 /**
4 * Short name format: "HST", "EDT", etc.
5 * Falls back to "GMT+/-offset" if there is no commonly used abbreviation.
6 */
7 ABBREVIATION: "abbreviation";
8 /**
9 * IANA timezone code: "Pacific/Honolulu", "America/New_York", etc.
10 */
11 CODE: "code";
12 /**
13 * Composite format: "Hawaii Time (HST) -10:00", "New York (EDT) -5:00", etc.
14 * Omits abbreviation if there is no short name (it is redundant with offset).
15 */
16 COMPOSITE: "composite";
17 /**
18 * Long name format: "Hawaii-Aleutian Standard Time", "Eastern Daylight Time", "Coordinated Universal Time", etc.
19 */
20 LONG_NAME: "long-name";
21 /**
22 * Offset format: "-10:00", "-5:00", etc.
23 */
24 OFFSET: "offset";
25};
26export type TimezoneDisplayFormat = (typeof TimezoneDisplayFormat)[keyof typeof TimezoneDisplayFormat];
27/**
28 * Formats a timezone according to the specified display format to show in the default `<Button>` rendered as the
29 * `<TimezoneSelect>` target element.
30 */
31export declare function formatTimezone(timezone: TimezoneWithNames | undefined, displayFormat: TimezoneDisplayFormat): string | undefined;