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

nanochrono

v1.0.0

Published

A lightweight human-readable time formatter (<1kb)

Readme

🕒 nanochrono

npm
version install
size npm
downloads license

nanochrono is an ultra-lightweight (<500B) human-readable time formatter for modern JavaScript apps.

It converts timestamps into friendly phrases like:

1 minute ago
3 hours ago
yesterday
in 2 days

Built for the modern web, nanochrono uses the native Intl.RelativeTimeFormat API, giving you built-in internationalization with zero extra bundle size.


✨ Features

🪶 Ultra Tiny

Less than 500 bytes minzipped.

🌍 Native Internationalization

Supports 100+ languages via built-in Intl APIs.

🚀 Zero Dependencies

No dependency tree, no vulnerabilities, no supply chain risk.

🛡️ Type Safe

Written in TypeScript with full typings and autocomplete.

⚡ Edge Runtime Ready

Works perfectly with:

  • Vercel Edge Functions
  • Cloudflare Workers
  • Deno
  • Bun
  • Node.js
  • Browsers

📦 Installation

npm install nanochrono

or

pnpm add nanochrono

or

yarn add nanochrono

🚀 Quick Start

import { formatRelative } from "nanochrono"

// 1 minute ago
formatRelative(Date.now() - 60000)

// 2 hours ago
formatRelative(Date.now() - 7200000)

// yesterday
formatRelative(Date.now() - 86400000)

🌍 Internationalization

nanochrono automatically supports any locale supported by the JavaScript runtime.

import { formatRelative } from "nanochrono"

// Spanish
formatRelative(Date.now() - 3600000, "es")
// "hace 1 hora"

// French
formatRelative(Date.now() - 172800000, "fr")
// "avant-hier"

// Japanese
formatRelative(Date.now() - 60000, "ja")
// "1分前"

No locale files required.
No additional imports.


📖 API

formatRelative(date, locale?)

Formats a date or timestamp into a human-readable relative time string.

Parameters


Parameter Type Description


date Date | number Date object or timestamp (milliseconds)

locale string Optional BCP-47 locale (e.g. "en", "fr", "es"). Defaults to "en"


Returns

string

Example:

formatRelative(Date.now() - 60000)
// "1 minute ago"

📊 Size Comparison

Library Minified Size Dependencies


Moment.js ~67 KB many Day.js ~7 KB plugins date-fns ~20 KB many nanochrono <500B 0

Perfect for performance-focused applications.


🧠 Why nanochrono?

Traditional date libraries ship large locale dictionaries.

Example:

moment/locale/fr.js
moment/locale/es.js
moment/locale/ja.js

Each language adds extra kilobytes to your bundle.

But modern JavaScript runtimes already include these translations via the Intl API.

nanochrono simply uses what already exists in the runtime, meaning:

✔ no locale imports
✔ no bundle growth
✔ instant global language support


🧩 Example Use Cases

Social feeds

5 minutes ago
2 hours ago
yesterday

Notifications

just now
1 minute ago
3 days ago

Messaging apps

last seen 2 minutes ago
sent 3 hours ago

Activity logs

updated 1 day ago
created 2 weeks ago

⚡ Edge & Serverless Friendly

nanochrono is ideal for modern runtimes:

Runtime Supported


Node.js ✅ Browser ✅ Deno ✅ Bun ✅ Cloudflare Workers ✅ Vercel Edge ✅


🛠 Example Integration

React

import { formatRelative } from "nanochrono"

export default function Post({ createdAt }) {
  return <span>{formatRelative(createdAt)}</span>
}

Express API

res.json({
  created: formatRelative(user.createdAt)
})

📜 License

MIT © Ammar Aamir


⭐ Support the Project

If you like nanochrono, please consider:

  • ⭐ Starring the repository
  • 🐛 Reporting issues
  • 💡 Suggesting improvements