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

timezone-utils-ts

v1.1.2

Published

A utility library for handling timezone operations in TypeScript

Readme

Project Title

A brief description of what this project does and who it's for

Time Zone Utilities Library

A lightweight library for handling time zone conversions, formatting, and validations using the powerful Luxon library.

Features

  • Convert date and time between time zones.
  • Get the current time in a specific time zone.
  • Fetch the UTC offset for a given time zone.
  • Check if Daylight Saving Time (DST) is active for a time zone.
  • Validate time zone strings.
  • Format dates in a specific time zone.

Installation

Install the library via npm:

npm install timezone-utils-ts

Usage

Import the required functions from the library:

import {
  convertTimeZone,
  getCurrentTime,
  getUtcOffset,
  isDstActive,
  isValidTimeZone,
  formatDate,
} from 'timezone-utils-ts';

API Documentation

1) convertTimeZone

Converts a date and time from one time zone to another.

Parameters

date (string | Date): The input date (ISO string or JavaScript Date object).

fromTimeZone (string): The source time zone.

toTimeZone (string): The target time zone.

Returns

A string representing the converted date in ISO format.

Example

convertTimeZone('2025-01-13T12:00:00', 'America/New_York', 'Asia/Kolkata');
// Output: '2025-01-13T22:30:00.000+05:30'

2. getCurrentTime

Fetches the current time in a specified time zone.

Parameters

timeZone (string): The desired time zone. Returns A string representing the current date and time in ISO format.

Example

getCurrentTime('Europe/London');
// Output: '2025-01-13T18:00:00.000Z'

3. getUtcOffset

Gets the UTC offset for a specific time zone.

Parameters

timeZone (string): The desired time zone. Returns A string representing the UTC offset (e.g., UTC+05:30).

Example

getUtcOffset('Asia/Tokyo');
// Output: 'UTC+09:00'

4. isDstActive

Checks if Daylight Saving Time (DST) is active for a time zone at a given date.

Parameters timeZone (string): The time zone to check. date (Date): The date to evaluate. Returns A boolean indicating if DST is active.

Example

isDstActive('America/New_York', new Date('2025-07-04'));
// Output: true

5. isValidTimeZone

Validates if a given string is a valid IANA time zone.

Parameters

timeZone (string): The time zone string to validate. Returns A boolean indicating if the time zone is valid.

Example

isValidTimeZone('Asia/Kolkata');
// Output: true

6. formatDate

Formats a date in a specified time zone.

Parameters

date (string | Date): The input date (ISO string or JavaScript Date object).

timeZone (string): The desired time zone.

format (string): The output format (default: yyyy-MM-dd HH:mm:ss).

Returns A formatted string representing the date.

Example

formatDate('2025-01-13T12:00:00', 'Asia/Kolkata', 'dd/MM/yyyy HH:mm:ss');
// Output: '13/01/2025 17:30:00'