npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@adnanghani07/iana-timezone-utils

v1.0.3

Published

Canonical IANA timezone utilities with legacy mapping, DST helpers, and abbreviations

Downloads

414

Readme

@adnanghani07/iana-timezone-utils

A lightweight, zero-dependency utility library for working with IANA timezones. It provides canonicalization of legacy timezone names, DST detection, and timezone abbreviations using native Intl APIs.

GitHub license npm version TypeScript

Features

  • 🌍 Canonicalization: Convert legacy or alias timezones (e.g., Asia/Calcutta) to their modern IANA canonical map (e.g., Asia/Kolkata).
  • 🕒 DST Detection: robustly check if a specific date is currently in Daylight Saving Time for any given timezone.
  • 📝 Abbreviations: Extract standard timezone abbreviations (e.g., EST, IST, GMT+5) using native browser APIs.
  • 📋 Listing: Get a complete list of all distinct canonical timezones supported by the library.
  • Zero Dependencies: Built on top of Intl and standard generic data.
  • 🔷 TypeScript: First-class type definitions included.

Installation

npm install @adnanghani07/iana-timezone-utils
# or
yarn add @adnanghani07/iana-timezone-utils
# or
pnpm add @adnanghani07/iana-timezone-utils

Usage

1. Canonicalize Timezones

Normalize legacy or aliased timezone identifiers to their primary IANA canonical ID.

import { canonicalizeTimezone } from "@adnanghani07/iana-timezone-utils";

console.log(canonicalizeTimezone("Asia/Calcutta")); // "Asia/Kolkata"
console.log(canonicalizeTimezone("US/Eastern")); // "America/New_York"
console.log(canonicalizeTimezone("UTC")); // "Etc/UTC"

2. Check for Daylight Saving Time (DST)

Determine if a specific timezone is observing Daylight Saving Time for a given date.

import { isDST } from "@adnanghani07/iana-timezone-utils";

// Check for current time
const isNewYorkDST = isDST("America/New_York");
console.log(`Is New York in DST? ${isNewYorkDST}`);

// Check for a specific date (e.g., Winter in NY)
const winterDate = new Date("2023-01-15T12:00:00Z");
console.log(isDST("America/New_York", winterDate)); // false

// Check for a specific date (e.g., Summer in NY)
const summerDate = new Date("2023-07-15T12:00:00Z");
console.log(isDST("America/New_York", summerDate)); // true

3. Get Timezone Abbreviation

Get the display abbreviation for a timezone at a specific point in time.

import { getTimezoneAbbreviation } from "@adnanghani07/iana-timezone-utils";

const abbr = getTimezoneAbbreviation("America/Los_Angeles");
console.log(abbr); // e.g., "PST" or "PDT" depending on current date

4. List All Canonical Timezones

Retrieve an array of all unique canonical timezone identifiers derived from the IANA database aliases.

import { listCanonicalTimezones } from "@adnanghani07/iana-timezone-utils";

const allZones = listCanonicalTimezones();
console.log(allZones);
// ["Africa/Abidjan", "Africa/Algiers", ..., "America/New_York", ...]

API Reference

canonicalizeTimezone(tz: string): string

Returns the canonical IANA ID for the given timezone string. If the timezone is already canonical or not found in the alias map, it returns the input key.

isDST(timezone: string, date?: Date): boolean

Returns true if the timezone is in Daylight Saving Time for the provided date. Defaults to new Date() if no date is provided.

getTimezoneAbbreviation(timezone: string, date?: Date): string

Returns the short abbreviation (e.g., "EST", "GMT+5:30") for the timezone at the given date.

listCanonicalTimezones(): string[]

Returns a sorted array of all canonical string identifiers.

License

MIT © Adnan Ghani