A TypeScript library for mapping between IANA and Windows time zones
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.
npm install winzonesimport { 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); // undefinedFinds 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
undefinedif not found
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
undefinedif not found
# 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 generateMIT © Execify
James Birtles james.birtles@execify.ai