Timezone
Timezone utility class for handling IANA timezone conversions and offsets. All methods are static and work with UTC dates.
Props
The following table outlines the props for the Timezone:
| Name | Type | Default | Description |
|---|---|---|---|
| timezoneData | - | Common IANA timezone identifiers for the timezone selector. |
Methods
The following table outlines the methods for the Timezone:
| Name | Parameters | Returns | Description |
|---|---|---|---|
| add | date : Datetimezone : string | Date | Convert a UTC date to the display wall-clock time in a target timezone. Adds the timezone offset to shift UTC to local time in the target zone. Params: |
| convert | date : DatefromOffsetOrZone : number | stringtoOffsetOrZone : number | string | Date | Convert a wall-clock time from one timezone/offset to another. Takes a date interpreted in the source timezone and converts it to target timezone. Params: |
| getLocalTimezoneName | - | string | Get a list of common IANA timezone identifiers for use in editor/UI selectors. |
| offset | date : Datetimezone : string | number | Get the UTC offset in minutes for a given date and timezone. Accounts for DST active at that specific date. Params: |
| remove | date : Datetimezone : string | Date | Remove the timezone offset from a wall-clock date, returning UTC equivalent. Interprets the input date as a local wall-clock in the given timezone and converts it to the equivalent UTC instant. Params: |
| removeLocalOffset | date : Date | Date | Remove the local runtime offset from a date. Useful when Date objects are created in local time and need normalization to UTC. Params: |