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

datr.js

v3.0.3

Published

Get the date in any format

Readme

Returns today's date in the given format

For example:

import * as date from "datr.js";

//This is just an example format
const dateNow = date.get("YY MMMM DD dddd hhhh:mmmm:ssss:s ZZZZ");

//Expected output 2022 June 6 Monday 19:25:12:352 +02:00
console.log(dateNow);

(Scroll down for further information)


Returns the day on which a particular date fell

For example:


import * as date from "datr.js";

//This is just an example
const day = date.getDayName(1, 1, 1998);

//Expected output: Thursday
console.log(day);


Returns the length of the given month or if there's no given month returns the length of the current month.

For example:


import * as date from "datr.js";

//This is just an example
const monthLength = date.getMonthLength("January");

//Expected output: 31
console.log(monthLength);

(Instead of "January" you can also use "january" or "1")


Returns the date after the specified days have elapsed

For example:


import * as date from "datr.js";

//It's 6th of june now
const days = date.daysFromNow(20);

//Expected output: { day: 26, month: 6, year: 2022 }
console.log(days);

Checks if the given year is leap year or not, or if there's no given year it returns if the current year is leap year or not.

For example:


import * as date from "datr.js";

const days = date.isLeapYear(2024);

//Expected output: true
console.log(days);


Format types: Y: The first two numbers of the year (2022 --> 22) YY: The whole year (2022)

M: The month in numbers (5 --> 5, 12 --> 12) MM: A zero and the month in numbers (5 --> 05, 12 --> 12) MMM: The short name of the month (December --> Dec) MMMM: The whole name of the month (December --> December)

D: The date (1 -->, 12 --> 12) DD: A zero and the date (1 --> 01, 12 --> 12)

d: The day of the week in numbers (Monday --> 1) dd: The first two letters of the day (Monday --> Mo) ddd: The first three letters of the day (Monday --> Mon) dddd: The day of the week (Monday --> Monday)

h: The current hour in 12 hour format (14:00 --> 2:00) hh: The current hour in 12 hour format with a zero before the hour (14:00 --> 02:00) hhh: The current hour in 24 hour format (1:00 --> 1:00) hhhh: The current hour in 24 hour format with a zero before the hour (1:00 --> 01:00)

m: The decimal place value of the current minute (12 --> 1) mm: The some place value of the current minute (12 --> 2) mmm: The current minute (12 --> 12, 8 --> 8) mmmm: The current minute and a zero (12 --> 12, 8 --> 08)

s: Milliseconds ss: The decimal place value of the current second (12 --> 1) sss: The some place value of the current second (12 --> 2) ssss: The current second and a zero (8 --> 08, 12 --> 12) sssss: The whole second (12 --> 12, 8 --> 8)

Z: The current time zone (+2) ZZ: The current timezone with a zero (+02) ZZZ: The current timezone with a zero and minutes (+0200) ZZZZ: The current timezone with a zero, minutes and a colon (+02:00)