Skip to content

JavaScript library for converting between IANA and Windows timezone identifiers with regularly updated CLDR data.

License

Notifications You must be signed in to change notification settings

Execify/winzones

Repository files navigation

winzones

A TypeScript library for mapping between IANA and Windows time zones

npm version License: MIT TypeScript

Data Source

This library uses timezone mapping data from the Unicode Common Locale Data Repository (CLDR), specifically the Windows timezone mappings. The data is regularly updated to reflect the latest timezone changes and Windows zone mappings.

We update this data regularly with new CLDR releases to ensure accuracy and completeness.

Installation

npm install winzones

Usage

import { findWindowsFromIana, findIanaFromWindows } from 'winzones';

// Convert IANA timezone to Windows
const windowsZone = findWindowsFromIana('America/New_York');
console.log(windowsZone); // 'Eastern Standard Time'

// Convert Windows timezone to IANA (returns array as one Windows zone can map to multiple IANA zones)
const ianaZones = findIanaFromWindows('Eastern Standard Time');
console.log(ianaZones); // ['America/New_York', 'America/Detroit', 'America/Toronto', ...]

// Handle cases where timezone is not found
const unknownZone = findWindowsFromIana('Invalid/Timezone');
console.log(unknownZone); // undefined

API

findWindowsFromIana(ianaTimezone: string): string | undefined

Finds the Windows timezone equivalent for an IANA timezone identifier.

  • Parameters: ianaTimezone - IANA timezone identifier (e.g., 'America/New_York')
  • Returns: Windows timezone name (e.g., 'Eastern Standard Time') or undefined if not found

findIanaFromWindows(windowsTimezone: string): string[] | undefined

Finds the IANA timezone equivalents for a Windows timezone.

  • Parameters: windowsTimezone - Windows timezone name (e.g., 'Eastern Standard Time')
  • Returns: Array of IANA timezone identifiers or undefined if not found

Development

# Install dependencies
npm install

# Run in development mode
npm run dev

# Build the library
npm run build

# Type check
npm run typecheck

# Regenerate timezone data from CLDR
npm run generate

License

MIT © Execify

Author

James Birtles james.birtles@execify.ai

About

JavaScript library for converting between IANA and Windows timezone identifiers with regularly updated CLDR data.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •