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

@jlhv/date-helper

v1.0.7

Published

A simple date helper utility for different time formats.

Readme

Date Helper Utility

Overview

The Date Helper Utility provides a set of functions to simplify date manipulation, formatting, arithmetic operations, timezone handling, and validations.

Installation

To install the package, run:

npm install @jlhv/date-helper

Usage

Import the required functions:

import {
  formatDate, getISODate, getUTCDate, getCurrentDate, getCurrentDateString,
  getDayOfWeek, getMonthOfYear, getYear,
  addDays, addWeeks, addMonths, addYears,
  subtractDays, subtractWeeks, subtractMonths, subtractYears,
  isLeapYear, getDaysInMonth, getFirstDayOfMonth, getLastDayOfMonth,
  getDaysBetweenDates, getWeeksBetweenDates, getMonthsBetweenDates, getYearsBetweenDates,
  getCurrentDateInTimezone, getTimezoneOffset, getTimezoneName, getTimezoneAbbreviation,
  isDaylightSavingTime, getDSTStart, getDSTEnd, getDSTOffset,
  getDSTStartInTimezone, getDSTEndInTimezone, getDSTOffsetInTimezone
} from "@jlhv/date-helper";

Functions

1. Date Formatting

formatDate(new Date()); // "2025-04-03 12:34:56"
formatDate("2025-04-03T12:34:56Z", "dd/MM/yyyy"); // "03/04/2025"

2. Date Retrieval

getISODate(); // "2025-04-03T12:34:56.789Z"
getUTCDate(); // "Thu, 03 Apr 2025 12:34:56 GMT"
getCurrentDate(); // Current Date object
getCurrentDateString(); // "2025-04-03 12:34:56"

3. Get Specific Parts of a Date

getDayOfWeek("2025-04-03"); // "Thursday"
getMonthOfYear("2025-04-03"); // "April"
getYear("2025-04-03"); // 2025

4. Arithmetic Operations

addDays("2025-04-03", 10); // 2025-04-13
addWeeks("2025-04-03", 2); // 2025-04-17
addMonths("2025-04-03", 1); // 2025-05-03
addYears("2025-04-03", 5); // 2030-04-03

5. Subtraction Operations

subtractDays("2025-04-03", 5); // 2025-03-29
subtractWeeks("2025-04-03", 2); // 2025-03-20
subtractMonths("2025-04-03", 1); // 2025-03-03
subtractYears("2025-04-03", 3); // 2022-04-03

6. Leap Year & Month Details

isLeapYear("2024-01-01"); // true
isLeapYear("2025-01-01"); // false

getDaysInMonth("2025-04-01"); // 30
getFirstDayOfMonth("2025-04-01"); // 2025-04-01
getLastDayOfMonth("2025-04-01"); // 2025-04-30

7. Difference Between Dates

getDaysBetweenDates("2025-04-01", "2025-04-10"); // 9
getWeeksBetweenDates("2025-04-01", "2025-04-15"); // 2
getMonthsBetweenDates("2025-01-01", "2025-04-01"); // 3
getYearsBetweenDates("2020-01-01", "2025-01-01"); // 5

8. Timezone Handling

getCurrentDateInTimezone("Asia/Kolkata"); // "2025-04-03 18:04:56"
getTimezoneOffset("2025-04-03"); // -330 (IST)
getTimezoneName(); // "Asia/Kolkata"
getTimezoneAbbreviation("2025-04-03"); // "IST"

9. Daylight Saving Time (DST)

isDaylightSavingTime("2025-06-01"); // true/false
getDSTStart("2025"); // DST start date
getDSTEnd("2025"); // DST end date
getDSTOffset("2025-06-01"); // -1 if DST active, 0 otherwise

10. DST Adjustments in Timezones

getDSTStartInTimezone("America/New_York"); // "2025-03-09 02:00:00"
getDSTEndInTimezone("America/New_York"); // "2025-11-02 02:00:00"
getDSTOffsetInTimezone("America/New_York", "2025-06-01"); // -1 or 0

License

ISC License.

Author

Vijayavel R.