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

anywhen

v0.1.4

Published

Lightweight human date formatting for any locale. Zero deps, native Intl.

Readme


~800b gzip. zero dependencies. 200+ locales — for free.

No locale files to import. No plugins to register. No config.

import { anydate, anywhen, anyago } from "anywhen";

anydate(date, "en"); // "Feb 5, 2016"
anywhen(date, "en"); // "yesterday, 2:35 PM"
anyago(date, "en"); // "3 hours ago"

anydate(date, "de"); // "5. Feb. 2016"
anywhen(date, "fr"); // "hier, 14:35"
anyago(date, "tr"); // "3 saat önce"

install

npm install anywhen

anydate — show me the date.

Always absolute. Pass any Intl.DateTimeFormat options.

anydate(date, "en"); // "Feb 5, 2016"
anydate(date, "en", { hour: "2-digit", minute: "2-digit" }); // "2:35 PM"
anydate(date, "en", {
  weekday: "long",
  month: "long",
  day: "numeric",
  year: "numeric",
}); // "Friday, February 5, 2016"
anydate(date, "en", { month: "long", year: "numeric" }); // "February 2016"

anydate(date, "de"); // "5. Feb. 2016"
anydate(date, "ja"); // "2016年2月5日"
anydate(date, "ar"); // "٥ فبراير ٢٠١٦"

anywhen — when was it.

Smart context — picks the right format automatically. Covers past and future.

anywhen(date, "en"); // "just now"
anywhen(date, "en"); // "10 minutes ago"
anywhen(date, "en"); // "today, 2:35 PM"
anywhen(date, "en"); // "yesterday, 9:00 AM"
anywhen(date, "de"); // "Mittwoch, 11:20"
anywhen(date, "en"); // "Feb 5, 2016"
anywhen(date, "en"); // "in 2 weeks"
anywhen(date, "ru"); // "через 3 месяца"

anywhen(date, "en", false); // "yesterday" — no clock

anyago — how long ago.

Always relative. Past and future.

anyago(date, "en"); // "3 hours ago"
anyago(date, "en"); // "yesterday"
anyago(date, "en"); // "in 2 weeks"
anyago(date, "de"); // "vor 3 Stunden"
anyago(date, "fr"); // "il y a 3 heures"
anyago(date, "tr"); // "3 saat önce"
anyago(date, "ru"); // "3 часа назад"

anyago(date, "en", true); // "1 day ago" instead of "yesterday"

anywhere — fix your locale.

One locale across all calls.

import { anywhere } from "anywhen";

const t = anywhere("de");

t.anydate(date); // "5. Feb. 2016"
t.anydate(date, {
  weekday: "long",
  month: "long",
  day: "numeric",
  year: "numeric",
}); // "Freitag, 5. Februar 2016"
t.anywhen(date); // "gestern, 14:35"
t.anyago(date); // "vor 3 Stunden"

vs the alternatives

| | anywhen | dayjs | date-fns | | ------------------- | :-------: | :---: | :------: | | gzip | ~800b | ~7kb | ~20kb | | locale data bundled | no | yes | yes | | locales | 200+ | 140 | 100 | | dependencies | 0 | 0 | 0 |


input types

Every function accepts Date, unix timestamp, or ISO string.

anydate(new Date(), "en");
anydate(Date.now(), "en");
anydate("2016-02-05T14:00:00Z", "en");

compatibility

Node.js 13+ · Chrome 71+ · Firefox 65+ · Safari 14+ · Edge Runtime