UNPKG

1.25 kBTypeScriptView Raw
1import type { TimezoneWithNames } from "./timezoneTypes";
2export type TimezoneDisplayFormat = "offset" | "abbreviation" | "name" | "composite" | "code" | "long-name";
3export declare const TimezoneDisplayFormat: {
4 /**
5 * Short name format: "HST", "EDT", etc.
6 * Falls back to "GMT+/-offset" if there is no commonly used abbreviation.
7 */
8 ABBREVIATION: "abbreviation";
9 /**
10 * IANA timezone code: "Pacific/Honolulu", "America/New_York", etc.
11 */
12 CODE: "code";
13 /**
14 * Composite format: "Hawaii Time (HST) -10:00", "New York (EDT) -5:00", etc.
15 * Omits abbreviation if there is no short name (it is redundant with offset).
16 */
17 COMPOSITE: "composite";
18 /**
19 * Long name format: "Hawaii-Aleutian Standard Time", "Eastern Daylight Time", "Coordinated Universal Time", etc.
20 */
21 LONG_NAME: "long-name";
22 /**
23 * Offset format: "-10:00", "-5:00", etc.
24 */
25 OFFSET: "offset";
26};
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;