I Got Tired of JavaScript's Date API So I Fixed It
Source: Dev.to
Enter WristWatch
WristWatch is my answer to JavaScript’s date problems. It’s a tiny library (less than 10 KB) with zero dependencies that wraps the native Date API in a way that actually makes sense (at least to me).
I didn’t want to build some massive framework like Moment.js. I just wanted something that would let me:
- Format dates without checking the docs every time
- Do date math without crying
- Remember function names without a PhD in JavaScript archaeology
- Not accidentally mutate dates and break everything
The Fun Parts
Months That Make Sense
Native Date.getMonth() returns 0‑11. In WristWatch, months are 1‑12 like a normal human would expect:
const date = new WristWatch('2025-12-05');
date.getMonth(); // 12 (December, not 11!)
Formatting That Doesn’t Suck
Want to format a date? Just tell it what you want:
const now = WristWatch.now();
now.format('YYYY-MM-DD'); // "2025-12-06"
now.format('MMMM D, YYYY'); // "December 6, 2025"
now.toRelative(); // "just now"
No more chaining together a dozen methods or importing an entire formatting library.
Date Math That Actually Works
Adding days to a date should be easy. In WristWatch, it is:
const today = WristWatch.now();
const tomorrow = today.add(1, 'day');
const nextWeek = today.add(1, 'week');
const nextMonth = today.add(1, 'month');
Everything’s immutable, so you can’t accidentally mess up your original date. It also handles edge cases like “what happens when I add a month to January 31st?” (Answer: you get February 28th, not March 3rd.)
Comparisons That Don’t Make You Think
Need to check if one date is before another? Just do it:
if (tomorrow.isAfter(today)) {
console.log('Tomorrow is in the future!');
}
if (date.isBetween(start, end)) {
console.log('Date is in range!');
}
No timestamp subtraction, no mental math, just straightforward comparisons.
The Technical Bits
Zero Dependencies
WristWatch has exactly zero dependencies. It’s a thin wrapper around the native Date API, which means it’s fast, reliable, and won’t break when some random dependency deprecates itself.
Fully Typed
Written in TypeScript from the ground up. Every function, every parameter, everything is typed.
Tree‑Shakeable
Only import what you need.
// Method chaining style
import { WristWatch } from '@lukelowers/wrist-watch';
const ww = WristWatch.now();
ww.add(1, 'day').format('YYYY-MM-DD');
// Functional style
import { now, format, add } from '@lukelowers/wrist-watch';
const date = now();
format(add(date.getDate(), 1, 'day'), 'YYYY-MM-DD');
Closely Related to the OG Solution
I didn’t want to recreate the original; I wanted to iterate on it. WristWatch is a wrapper that still reminds you of the old ways without trying to compete with larger libraries.
Actually Tested
Property‑based testing with fast-check ensures everything works. Hundreds of random test cases run through every function, and the code is open for anyone to test further.
The Real Talk
Everyone tells you not to build a date library. “Just use Moment!” they say. “Just use date‑fns!” they say.
Moment is deprecated. date‑fns is great but it’s huge. Sometimes you just want something simple that does exactly what you need without importing half of npm.
WristWatch isn’t trying to be everything to everyone. It’s trying to be the library I wish existed: small, focused, and actually pleasant to use.
Want to Try It?
npm install @lukelowers/wrist-watch
The GitHub repo has full docs and examples. PRs welcome if you find something broken or want to add a feature.