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

@nivinjoseph/n-date

v2.0.4

Published

Immutable, serializable date/time with first-class timezone support, wrapping luxon

Readme

n-date

An immutable, serializable date/time library for TypeScript with first-class timezone support. It wraps Luxon behind a small value type that round-trips cleanly through JSON.

Installation

npm install @nivinjoseph/n-date

# or

yarn add @nivinjoseph/n-date

Requires Node.js >= 24.10. The package is published as pure ESM.

Usage

import { DateTime, DateTimeSpan, DateTimeFormat } from "@nivinjoseph/n-date";
import { Duration } from "@nivinjoseph/n-util";

const now = DateTime.now("America/New_York");
const later = now.addTime(Duration.fromHours(2));

// comparison
later.isAfter(now);                 // true
now.isSameDay(later);               // same calendar day?

// intervals
const span = new DateTimeSpan({ start: now, end: later });
span.contains(now.addTime(Duration.fromMinutes(30)));   // true
span.duration.toHours();                                // 2

// zones preserve the instant
const tokyo = now.convertToZone("Asia/Tokyo");
tokyo.timestamp === now.timestamp;  // true

// formatting
later.format(DateTimeFormat.yearMonthDay);   // e.g. "2026-04-20"
later.formatExt("DDDD");                     // e.g. "Monday, April 20, 2026"

// serialization
const json = JSON.stringify(now.serialize());

Design

  • Immutable — every mutating-looking method (addTime, convertToZone, …) returns a new DateTime (convertToZone returns the same instance when the zone is unchanged).
  • Explicit timezones — there is no machine-local zone ("local", "system" and "default" are all rejected); callers pass an IANA zone, "utc", or a UTC±HH:MM offset.
  • Serializable — DateTime and DateTimeSpan extend DomainObject from @nivinjoseph/n-domain, so they round-trip through JSON with their type tag preserved.
  • Defensive — inputs are validated with @nivinjoseph/n-defensive and invalid values throw at construction time rather than silently producing bad dates. Use DateTime.tryCreate when parsing untrusted input.
  • Second precision — a value is yyyy-MM-dd HH:mm:ss; milliseconds are not retained.

Documentation

Full documentation lives in docs/:

  • Getting Started — installation, concepts, and a quick tour.
  • DateTime — the core immutable date/time type.
  • DateTimeSpan — intervals between two DateTime values.
  • Formats — DateTimeFormat and DateTimeFormatExt reference.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.