windows-iana
v5.1.0
Published
A small tool to convert between Windows time zones and IANA
Downloads
146,971
Maintainers
Readme
This library exports two functions to help convert from Windows time zones to IANA time zones (based on this mapping definition and this list of IANA aliases).
Installation
Add the dependency to your project with npm install --save windows-iana
or
yarn add windows-iana
.
Compatibility
The library should work on Node.js >= 12 and all modern broswers. However, it does use
[].flat()
,
which is not supported on IE and would require a polyfill.
Usage
The library exports:
findIana()
: returns an array of possible IANA time zones (including all their aliases) for a given Windows zone.findWindows()
: returns an array of possible Windows time zones for a given IANA zone and all its aliases.findIanaAliases()
: returns an array of IANA aliases for a given IANA zone name, including the one passed as a parameter.IANA_ALIAS_MAP
: the IANA alias map used by the library.WINDOWS_TO_IANA_MAP
: the Windows to IANA map used by the library.
findIana()
import { findIana } from 'windows-iana';
const result = findIana('Romance Standard Time');
console.log(result); // ['Europe/Paris', 'Europe/Brussels', 'Europe/Copenhagen', 'Europe/Madrid', 'Africa/Ceuta']
findWindows()
import { findWindows } from 'windows-iana';
const result = findWindows('America/New_York');
console.log(result); // ['Eastern Standard Time']
findIanaAliases()
import { findIanaAliases } from 'windows-iana';
const result = findIanaAliases('Asia/Ho_Chi_Minh');
console.log(result); // ['Asia/Saigon', 'Asia/Ho_Chi_Minh']