@sytexa/tzdb-revised
v1.6.0
Published
This package slightly extends / modifies @vvo/tzdb for our specific use case.
Downloads
5
Readme
Important
This package slightly extends / modifies @vvo/tzdb for our specific use case.
You probably want the original version by VVO:
All credit to the original author VVO
Changes
Deprecated time zone names are moved to their own key in the time zone object, instead of grouping them with group
:
{
name: "America/New_York",
alternativeName: "Eastern Time",
group: [
"America/Detroit",
"America/Indiana/Indianapolis",
"America/Indiana/Marengo",
"America/Indiana/Petersburg",
"America/Indiana/Vevay",
"America/Indiana/Vincennes",
"America/Indiana/Winamac",
"America/Kentucky/Louisville",
"America/Kentucky/Monticello",
"America/New_York"
],
deprecatedNames: [
"US/Michigan",
"America/Fort_Wayne",
"America/Indianapolis",
"US/East-Indiana",
"America/Louisville",
"US/Eastern"
],
continentCode: "NA",
continentName: "North America",
countryName: "United States",
countryCode: "US",
mainCities: ["New York City", "Brooklyn", "Queens", "Philadelphia"],
rawOffsetInMinutes: -300,
abbreviation: "EST",
rawFormat: "-05:00 Eastern Time - New York City, Brooklyn, Queens, Philadelphia"
}
Useful if you don't want or need to support the deprecated time zones...
getUngroupedTimeZones()
This package also adds the getUngroupedTimeZones()
function, which returns an array of simplified time zone objects with current time information. We prefer this for creating time zone selection boxes when deprecated time zones are not required.
[
// ...
{
name: "America/Los_Angeles",
currentTimeOffsetInMinutes: -420, // "current" time zone offset, this is why getUngroupedTimeZones() is a method and not just an object: it works at runtime
currentTimeFormat: "(UTC -7) America/Los Angeles",
},
// ...
];