Usage
Typescript Import Format
//This namespace exports multiple static methods or members. To import
import * as TimeZoneUtils from "ojs/ojtimezoneutils";
//Now you can access the methods as TimeZoneUtils.methodName and so on
For additional information visit:
Methods
-
(static) getAvailableTimeZones(): Array<AvailableTimeZoneType>
-
Gets the timezones supported by the JET converters for the current Locale. The data comes from CLDR.
If you want to display a list of all supported timezones, then you can use this api. NOTE: This module automatically imports 'ojs/ojtimezonedata' which is a module with a large amount of data. If you want to format a date in the user's local timezone, do not use this api. Instead you should use a iso string that is local to the user's system. For convenience, you can use IntlConverterUtils.dateToLocalIsoDateString or IntlConverterUtils.dateToLocalIso. Or you can get the user's local timezone offset and pass that to the datetime converter. timeZone: IntlConverterUtils.getLocalTimeZoneOffset()
The returned value is an array of AvailableTimeZoneType objects. Each object represents a timezone and contains 2 properties:
Property Description id IANA timezone ID displayName It is the concatenation of three strings: - UTC timezone offset
- Localized city name. Some cities do not have translations, se we have to skip them.
- Generic time zone name
If you do not use a timezone from this list as the timezone property in JET's datetime converter, the converter will throw an error.
Returns:
supported timezones- Type
- Array.<AvailableTimeZoneType>