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

@lazyutil/dater

v0.9.5

Published

DateTime, TimeZone, Duration and Period library aimed at providing a consistent and complete date-time interface, away from the original JavaScript Date class.

Readme

dater

Synopsis

dater is a library of date/time utilities, all of which are aware of time zones and daylight saving time. It provides for calculating with Durations (amount of UTC milliseconds) and with Periods (regular intervals in some timezone's time, which might be irregular in UTC). It has aware DateTimes (with timezone) and unaware DateTimes (without timezone) and you are prevented from mixing the two in calculations.

Why another date library?

Other libraries are great, we had different requirements. The main thing for us was that calculations should be stable and predictable, especially around DST change moments. Above all, it should give the same answers across platforms.

Try for example to convert some edge case timestamps back and forth between local and UTC or keep adding one hour to a timestamp through daylight saving time changes.

  • Consistent behaviour across platforms and with different TZ environment variable settings
  • Correct time zone conversions back and forth
  • Correct Daylight Saving Time handling with predictable behavior for non-existing hours during DST changes
  • Feature-rich:
    • DateTime class with or without time zone
    • Durations with units
    • Calculating with dates and durations across time zones
    • Periods with regular UTC or regular local time repetition
    • Utility functions for determining leap years, determining the last Monday of the month etc.
    • Formatting and parsing of dates using LDML format strings
    • Usable from Node.JS (CommonJS and ESM)
  • Good test coverage
  • dater is written in TypeScript and typings are included

TZ Data

The TZ data is installed as a separate NPM module tzdata. For browser use, the data is NOT automatically included, to allow you to choose a subset of the data to optimize your bundle.

Separating the TZ data from dater has three advantages:

  1. The data becomes useful to other modules than just dater
  2. By choosing for e.g. 'tzdata-northamerica', you can install just the time zones you need, which is handy for browser use (smaller footprint).
  3. The upgrades to the TZ data become independent of changes to dater. That means you do not have to upgrade to the latest dater version to get the latest TZ data.

Usage

Node.JS

In Node.JS, dater automatically picks up the installed tzdata.

Install using:

npm install @lazyutil/dater

Then require the module in your code. dater will automatically find any installed tzdata modules:

const tc = require("@lazyutil/dater");

Or with ESM:

import * as tc from "@lazyutil/dater";

Quick example

const tc = require("@lazyutil/dater");

const utc = tc.nowUtc();
const local = utc.toZone(tc.zone('localtime'));
const diff = local.toZone(null).diff(utc.toZone(null));
const hourDiff = tc.hours(diff.hours());
console.log("Difference between local and UTC:", hourDiff.toString());

Webpack

Use a >=2.x version of webpack. Use a plugin to load the time zone data you need.

  plugins: [
    new webpack.ContextReplacementPlugin(
      /[\/\\]node_modules[\/\\]@lazyutil[\/\\]dater[\/\\]/,
      path.resolve("tz-database-context"),
      {
        "tzdata-backward-utc": "tzdata-backward-utc",
        "tzdata-etcetera": "tzdata-etcetera",
        "tzdata-europe": "tzdata-europe"
      }
    )
  ]

License

MIT