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

date-add-days

v1.0.2

Published

Date manipulation dead simple. No dependencies.

Readme

date-add-days

Dead simple date manipulation. A lightweight TypeScript utility library for common date operations with zero dependencies.

Installation

npm install date-add-days

Usage

Import the functions you need:

import { addDays, endOfDay, toIsoDate } from 'date-add-days';

// Add 5 days to current date
const futureDate = addDays(new Date(), 5);

API Reference

addDays(date: Date, days: number): Date

Adds the specified number of days to a date, returning a new Date object.

const nextWeek = addDays(new Date(), 7);

endOfDay(day: Date): Date

Returns a Date object representing the last moment of the provided day (23:59:59.999).

const dayEnd = endOfDay(new Date());

addHours(date: Date, hours: number): Date

Adds the specified number of hours to a date. Supports fractional hours.

const later = addHours(new Date(), 2.5); // Add 2 hours and 30 minutes

addMinutes(date: Date, minutes: number): Date

Adds the specified number of minutes to a date. Supports fractional minutes.

const soon = addMinutes(new Date(), 30);

addSeconds(date: Date, seconds: number): Date

Adds the specified number of seconds to a date. Supports fractional seconds.

const justAfter = addSeconds(new Date(), 45);

daysLeft(date: Date): number

Calculates the number of whole days remaining between now and the specified date.

const deadline = new Date('2025-12-31');
const remainingDays = daysLeft(deadline);

yesterday(): Date

Returns a Date object representing yesterday's date.

const yesterdayDate = yesterday();

toIsoDate(date: Date): string

Converts a Date to ISO date string format (YYYY-MM-DD).

const isoDate = toIsoDate(new Date()); // e.g. "2025-04-22"

toUnixTimestamp(date: Date): number

Converts a Date object to a Unix timestamp (seconds since epoch).

const timestamp = toUnixTimestamp(new Date());

Examples

Working with upcoming events:

import { addDays, daysLeft, toIsoDate } from 'date-add-days';

const eventDate = addDays(new Date(), 14);
console.log(`Event scheduled for: ${toIsoDate(eventDate)}`);
console.log(`${daysLeft(eventDate)} days remaining until the event`);

Time-based calculations:

import { addHours, endOfDay, toUnixTimestamp } from 'date-add-days';

const current = new Date();
const meetingEnd = addHours(current, 1.5);
const dayEnding = endOfDay(current);

console.log(`Meeting ends at timestamp: ${toUnixTimestamp(meetingEnd)}`);
console.log(`Day ends at timestamp: ${toUnixTimestamp(dayEnding)}`);

License

MIT