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

time-wise

v3.2.1

Published

A Model-Driven Approach to Date and Time

Readme

Time-Wise

A Model-Driven Approach to Date and Time!

Documentation

Jump into the docs!

Features

  • DateTime

    Easily create, format, and compare DateTime objects with precision, supporting various time zones.

  • Duration

    Perform arithmetic operations with durations, including conversion between time units like seconds, minutes, hours, and more.

  • Offset

    Handle time zone offsets and calculate time differences accurately, taking into account daylight savings and other factors.

  • Interval

    Work with time intervals to compute intersections, contains, and durations, offering enhanced flexibility in managing time spans.

Installation

Install via npm:

npm install time-wise

Import

ES Modules

When using ESM:

import { DateTime, Offset, Interval, Duration } from "time-wise";

CommonJS

When using CJS:

const { DateTime, Offset, Interval, Duration } = require("time-wise");

Browser

When using browser, include the script tag:

<script src="time-wise.iife.js"></script>
<script>
  const { DateTime, Offset, Interval, Duration } = TimeWise;
</script>

Have fun with ...

DateTime

Wanna know what time it is in your favorite city right now?

DateTime.now().inZone("America/New_York").toString();

// 2025-01-01 15:45:30.250 UTC-05:00

Create a special datetime; Maybe the day you fell in love?

DateTime.fromObject({
  year: 2024,
  month: 2,
  day: 14,
  hour: 18,
  minute: 0,
  second: 0,
  millisecond: 0,
  offset: { hour: 1 }, // Paris? wow!
});

Offset

Which city is more to the west?

const losAngeles = Offset.fromZoneName("America/Los_Angeles");
const newYork = Offset.fromZoneName("America/New_York");

losAngeles.isWesterThan(newYork); // true

Interval

How many milliseconds has passed since your were born?

const birthday = DateTime.fromObject({
  year: 2000,
  month: 12,
  day: 7,
  hour: 0,
  minute: 0,
  second: 0,
  millisecond: 0,
  offset: { hour: 1 },
});
const now = DateTime.now();
Interval.between(birthday, now).duration.inMilliseconds;

// 761093667321

Duration

If each year of a dog's life is 7x of a humans, which is bigger? 1800 dog days? or 9000 human days?

const dogs = Duration.fromDays(1800).multiplyBy(7);
const humans = Duration.fromDays(9000);

dogs.isLongerThan(humans); // true

License

This library is licensed under the MIT License. See LICENSE for more information.

Contributing

Contributions are welcome! Please open an issue to discuss any major changes and check the CONTRIBUTING.md for guidelines on contributing to this project.