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
.
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);
You may also pass the territory code as a second parameter (have a look at the
mapping by unicode.org
for more details).
import { findOneIana } from 'windows-iana';
const result = findIana('Romance Standard Time', 'ES');
console.log(result);
findWindows()
import { findWindows } from 'windows-iana';
const result = findWindows('America/New_York');
console.log(result);
findIanaAliases()
import { findIanaAliases } from 'windows-iana';
const result = findIanaAliases('Asia/Ho_Chi_Minh');
console.log(result);