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 🙏

© 2025 – Pkg Stats / Ryan Hefner

dtx

v0.3.3

Published

Lightweight date time manipulation library

Readme

DTx

Lightweight date time manipulating library.

Installation

Use npm package manager to install the DTX

npm install dtx

Usage

Follow example

var dt = require('dtx');
var now = dt().format('%Y-%m-%d'); // Current date, for example, 2015-01-01
var next_week = dt().add(1, 'week').format('%F'); // Same format as above

Methods

format(pattern)

Return formated string using pattern

  • %Y - The year as a decimal number including the century.

  • %y - The year as a decimal number without a century (range 00 to 99).

  • %m - The month as a decimal number (range 01 to 12).

  • %d - The day of the month as a decimal number (range 01 to 31).

  • %H - The hour as a decimal number using a 24-hour clock (range 00 to 23).

  • %I - The hour as a decimal number using a 12-hour clock (range 01 to 12).

  • %M - The minute as a decimal number (range 00 to 59).

  • %S - The second as a decimal number (range 00 to 60). (The range is up to 60 to allow for occasional leap seconds.)

  • %s - The number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). (TZ)

  • %u - The day of the week as a decimal, range 1 to 7, Monday being 1. See also %w. (SU)

  • %w - The day of the week as a decimal, range 0 to 6, Sunday being 0. See also %u.

  • %p - Either "AM" or "PM" according to the given time value, or the corresponding strings for the current locale. Noon is treated as "PM" and midnight as "AM".

  • %P - Like %p but in lowercase: "am" or "pm" or a corresponding string for the current locale. (GNU)

  • %D - Equivalent to %m/%d/%y. (Yecch-for Americans only. Americans should note that in other countries %d/%m/%y is rather common. This means that in international context this format is ambiguous and should not be used.) (SU)

  • %F - Equivalent to %Y-%m-%d (the ISO 8601 date format). (C99)

  • %R - The time in 24-hour notation (%H:%M). (SU) For a version including the seconds, see %T below.

  • %r - The time in a.m. or p.m. notation. In the POSIX locale this is equivalent to %I:%M:%S %p. (SU)

  • %T - The time in 24-hour notation (%H:%M:%S). (SU)

  • %z - The +hhmm or -hhmm numeric timezone (that is, the hour and minute offset from UTC). (SU)

toDate()

Return Date object of current date in object.

add(count, type)

Add count of type (second, minute, houre, day, week, month, year) to current date and returns this.

subtract(count, type)

Alias for add method with negative count value.

diff(dtx, type)

Get diff between two dtx objects. Type can be one of second, minute, houre, day, week, month, year.

For example:

var dtx = require('dtx');

var dt1 = dtx('2015-10-10');
var dt2 = dtx('2015-01-01');

console.log(dt2.diff(dt1, 'days'));