I built date-light, a small zero-dependency date utility library for JavaScript and TypeScript.
I wanted something focused on the common date operations I use most often: formatting, parsing, date math, comparisons, and start/end helpers, without pulling in a larger date library for simple use cases.
What it includes
- 39 date utility functions
- Zero runtime dependencies
- TypeScript types
- ESM and CommonJS builds
- date-fns-style format tokens
- A docs/playground site for quickly trying the API
Playground
You can try it here:
https://date-light.flyingsquirrel.me/?v=20260607
Install
npm install date-light
It also works with:
yarn add date-light
pnpm add date-light
bun add date-light
Example
import { format, addDays, differenceInDays } from "date-light";
const today = new Date("2026-06-07T10:30:00");
console.log(format(today, "yyyy-MM-dd"));
console.log(format(addDays(today, 7), "yyyy-MM-dd"));
console.log(differenceInDays(new Date("2026-06-14"), today));
Why I made it
For many projects, I only need a focused set of date helpers:
- Format a date for UI
- Parse an ISO or pattern-based date string
- Add or subtract days, months, years, hours, minutes, or seconds
- Compare two dates
- Snap dates to day, week, month, or year boundaries
I wanted the package to stay small, typed, and easy to evaluate before installing.
Links
Docs/playground:
https://date-light.flyingsquirrel.me/?v=20260607
GitHub:
https://github.com/flyingsquirrel0419/date-light
npm:
https://www.npmjs.com/package/date-light
I would love feedback on the API naming, date edge cases, and whether the playground/docs make the package easy to evaluate.
If you find the project useful, a GitHub star would also help other developers discover it.
Top comments (0)