/windows-iana

A small tool to convert Windows time zones to IANA

Primary LanguageTypeScriptMIT LicenseMIT

windows-iana

Build Status Coverage Status

This library exports two functions to help convert from Windows time zones to IANA time zones (based on this mapping definition).

Installation

Add the dependency to your project with npm install --save windows-iana or yarn add windows-iana.

Usage

The library exports findIana(), which will return an array of possible IANA time zones, or findOneIana(), which will return just one string.

findOneIana()

import { findOneIana } from "windows-iana";

const result = findOneIana("Romance Standard Time");
console.log(result); // "Europe/Paris"

You may also pass the territory code as a second parameter (have a look again at the mapping by unicode.org for more details).

import { findOneIana } from "windows-iana";

const result = findOneIana("Romance Standard Time", "ES");
console.log(result); // "Europe/Madrid"

findIana()

import { findIana } from "windows-iana";

const result = findIana("Romance Standard Time");
console.log(result); // ["Europe/Paris"]

You may also pass the territory code to findIana().

import { findIana } from "windows-iana";

const result = findIana("Romance Standard Time", "ES");
console.log(result); // ["Europe/Madrid", "Africa/Ceuta"]