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

whenny

v1.0.8

Published

A modern date library for the AI era. Own your code. Configure your voice. Never think about timezones again.

Readme

whenny

The core Whenny date library. A modern, configurable date formatting library for the AI era.

Installation

npm install whenny

Or use the shadcn-style CLI:

npx create-whenny init
npx create-whenny add relative smart calendar

Usage

import { whenny, duration, calendar, compare, relative, smart } from 'whenny'

// Main Whenny class - chainable API
const w = whenny(new Date())

w.smart()                    // Context-aware formatting
w.relative()                 // "5 minutes ago"
w.short()                    // "Jan 15"
w.long()                     // "January 15, 2024"
w.time()                     // "3:45 PM"
w.datetime()                 // "Jan 15, 3:45 PM"
w.iso()                      // ISO 8601 string
w.format('{monthFull} {day}, {year}')  // Custom format

// Standalone functions
relative(date)               // "5 minutes ago"
smart(date)                  // Context-aware
duration(seconds)            // Duration formatting
compare(dateA, dateB)        // Date comparison

Configuration

import { defineConfig, configure } from 'whenny/config'

const config = defineConfig({
  locale: 'en-US',
  relative: {
    justNow: 'just now',
    minutesAgo: (n) => `${n} minute${n === 1 ? '' : 's'} ago`,
  },
  formats: {
    presets: {
      short: '{monthShort} {day}',
    },
    hour12: true,
  },
})

configure(config)

Themes

import { themes } from 'whenny/themes'
import { configure } from 'whenny'

// casual, formal, slack, twitter, discord, github, minimal, technical
configure(themes.slack)

Modules

The library is organized into modules that can be imported individually:

  • core - Parsing, arithmetic, comparisons, formatting
  • relative - Relative time formatting ("5 minutes ago")
  • smart - Context-aware smart formatting
  • compare - Date comparison utilities
  • duration - Duration formatting
  • calendar - Calendar helpers (isWeekend, isBusinessDay, etc.)
  • transfer - Server/browser timezone transfer protocol
  • natural - Natural language parsing

API Reference

whenny(date)

Creates a new Whenny instance.

const w = whenny(new Date())
const w = whenny('2024-01-15')
const w = whenny(1705334400000)

relative(date)

Format a date relative to now.

relative(new Date(Date.now() - 5 * 60 * 1000))  // "5 minutes ago"
relative(new Date(Date.now() + 60 * 60 * 1000)) // "in 1 hour"

smart(date)

Format with context-aware buckets.

smart(date)  // "just now" | "5 minutes ago" | "Yesterday at 3:45 PM" | "Monday at 9:00 AM" | "Jan 15"

duration(seconds)

Format a duration in seconds.

duration(3661).long()     // "1 hour, 1 minute, 1 second"
duration(3661).compact()  // "1h 1m 1s"
duration(3661).clock()    // "1:01:01"
duration(3661).human()    // "about 1 hour"

compare(dateA, dateB)

Compare two dates.

compare(earlier, later).smart()   // "2 days before"
compare(earlier, later).days()    // 2
compare(earlier, later).hours()   // 48
compare(earlier, later).seconds() // 172800

calendar

Calendar utility functions.

calendar.isToday(date)
calendar.isYesterday(date)
calendar.isTomorrow(date)
calendar.isWeekend(date)
calendar.isWeekday(date)
calendar.isBusinessDay(date)
calendar.isPast(date)
calendar.isFuture(date)
calendar.daysUntil(date)
calendar.daysSince(date)
calendar.startOf(date, 'month')
calendar.endOf(date, 'month')
calendar.add(date, 5, 'days')
calendar.subtract(date, 1, 'week')

transfer

Transfer protocol for server/browser date serialization.

// Server
const json = transfer.toJSON(date, 'America/New_York')

// Client
const { date, originZone, originOffset } = transfer.fromJSON(json)

natural

Natural language date parsing.

natural.parse('tomorrow')
natural.parse('next friday')
natural.parse('in 2 hours')
natural.parse('december 25th')

License

MIT