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

@date-js/date-formatter

v2.0.1

Published

Tiny date formatter with locale support. Zero dependencies, under 1KB gzipped.

Readme

@date-js/date-formatter

npm license

Format a date. Nothing else. Under 1KB gzipped.

No config. No plugins. No dependencies. Locale support out of the box via the native Intl API.

DateFormatter.format('%l, %F %j %Y', new Date());
// Sunday, March 29 2026

DateFormatter.format('%l %j %F %Y', new Date(), 'fr-FR');
// dimanche 29 mars 2026

Why this lib?

If all you need is to display a date, there's no point in shipping a full date toolkit. Perfect for landing pages, lightweight widgets, or any project where pulling in a full date library would be overkill.

  • Under 1KB gzipped — no dead code, no bloat
  • Zero dependencies — nothing to audit, nothing to break
  • Locale support out of the box — automatically uses the browser language, no config needed
  • Familiar syntax%Y-%m-%d style, like PHP's date() or Python's strftime

Install & Usage

With a bundler (webpack, Vite, Rollup…)

npm install @date-js/date-formatter

Use the default export to get a ready-to-use singleton:

import DateFormatter from '@date-js/date-formatter';

DateFormatter.format('%d/%m/%Y', new Date()); // 29/03/2026
DateFormatter.setLocale('fr-FR');
DateFormatter.format('%l %j %F %Y', new Date()); // dimanche 29 mars 2026

Or import the class directly to create isolated instances (useful when managing multiple locales):

import { DateFormatter } from '@date-js/date-formatter';

const fr = new DateFormatter('fr-FR');
const en = new DateFormatter('en-US');

fr.format('%l %j %F %Y', new Date()); // dimanche 29 mars 2026
en.format('%l %j %F %Y', new Date()); // Sunday March 29 2026

In a browser — classic script tag

The UMD bundle exposes DateFormatter as a global:

<script src="https://cdn.jsdelivr.net/npm/@date-js/date-formatter@2/dist/date-formatter.
js"></script>
<script>
  DateFormatter.format('%d/%m/%Y', new Date()); // 29/03/2026
</script>

In a browser — ES module

Modern browsers support <script type="module"> without any bundler:

<script type="module">
  import DateFormatter from 'https://cdn.jsdelivr.
  net/npm/@date-js/date-formatter@2/dist/date-formatter.js';

  DateFormatter.format('%d/%m/%Y', new Date()); // 29/03/2026
</script>

Format specifiers

| Specifier | Description | Example | |---|---|---| | %Y | Year, 4 digits | 2026 | | %y | Year, 2 digits | 26 | | %d | Day of the month, with leading zero | 0131 | | %j | Day of the month, without leading zero | 131 | | %l | Full weekday name (locale-aware) | Sunday, dimanche | | %D | Short weekday name (locale-aware) | Sun, dim. | | %F | Full month name (locale-aware) | March, mars | | %M | Short month name (locale-aware) | Mar, mars | | %m | Month, with leading zero | 0112 | | %n | Month, without leading zero | 112 | | %H | Hour (24h), with leading zero | 0023 | | %G | Hour (24h), without leading zero | 023 | | %i | Minutes, with leading zero | 0059 | | %s | Seconds, with leading zero | 0059 |

Escape a % with a backslash: \%.

License

MIT