Why Whenny?
Built from scratch for modern applications. Three core ideas make it different.
Own Your Code
Like shadcn/ui, Whenny copies code directly into your project. Your AI assistant can read and modify it. No dependency lock-in.
Configure Your Voice
One config file controls every string Whenny outputs. Want formal? Casual? Emoji-heavy? Change it once, update everywhere.
Timezone Solved
The Transfer Protocol carries timezone context across the wire. Server and browser always show the right time. Automatically.
Clean, Intuitive API
Smart Formatting
Context-aware output that picks the best representation
import { whenny } from 'whenny'
// Automatically picks the best format
whenny(date).smart()
// → "just now"
// → "5 minutes ago"
// → "Yesterday at 3:45 PM"
// → "Monday at 9:00 AM"
// → "Jan 15"Configurable Output
Every string is customizable via your config
// whenny.config.ts
export default defineConfig({
relative: {
justNow: 'moments ago',
minutesAgo: (n) => `${n}m ago`,
hoursAgo: (n) => `${n}h ago`,
},
formats: {
presets: {
short: '{day}/{month}/{year}',
}
}
})React Hooks
Auto-updating times with zero boilerplate
import { useRelativeTime, useCountdown } from 'whenny-react'
function Comment({ createdAt }) {
// Updates automatically every minute
const time = useRelativeTime(createdAt)
return <span>{time}</span>
}
function Sale({ endsAt }) {
const { days, hours, minutes } = useCountdown(endsAt)
return <span>{days}d {hours}h {minutes}m</span>
}Transfer Protocol
Timezones that work across server and browser
// Server: serialize with context
import { transfer } from 'whenny'
const data = {
createdAt: transfer.toJSON(event.createdAt, 'America/New_York')
}
// Browser: deserialize and format
const { date, originZone } = transfer.fromJSON(data.createdAt)
// Shows "3:00 PM ET" - original timezone preserved!Get Started
Choose your style: package or copy
NPM Package
Traditional installation. Works great.
npm install whenny whenny-reactshadcn Style
Copy code into your project. Full ownership.
npx whenny init
npx whenny add relative smartPre-built Themes
Start with a theme that matches your product's personality
Casual
5 mins ago
Default, friendly
Formal
5 minutes ago
Professional
Slack
5m
Compact
5m
Social media
Discord
Today at 3:45 PM
Chat apps
GitHub
5 minutes ago
Dev tools
Minimal
5 min
Clean, simple
Technical
300s
Precise, numeric