Skip to content

flyingsquirrel0419/date-light

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

date-light

date-light

CI Test npm version coverage License: MIT TypeScript

The date helpers you actually ship. Nothing else.

39 fully typed date utilities in ~3.11 KB minzipped. Zero dependencies. Immutable by default.

Install · Why date-light? · Docs · API


Why date-light?

Most apps only need a small, predictable slice of date-fns: format a date, parse input, add a few days, compare ranges, snap to day/week/month boundaries.

date-light keeps that slice tiny:

  • 3.11 KB minzipped for 39 common utilities
  • Zero runtime dependencies
  • TypeScript-first with generated declarations
  • Immutable functions that never mutate input dates
  • date-fns-style API surface for the common calls people reach for most
  • ESM + CJS package entrypoints verified before release
import { addDays, differenceInDays, format, startOfWeek } from "date-light";

const launch = new Date(2026, 5, 30, 14, 30);
const reminder = addDays(launch, -7);

format(launch, "yyyy-MM-dd HH:mm"); // "2026-06-30 14:30"
format(startOfWeek(launch), "yyyy-MM-dd"); // "2026-06-29"
differenceInDays(launch, reminder); // 7

Install

npm install date-light
yarn add date-light
pnpm add date-light
bun add date-light

Works in Node.js 18+ and modern browsers.

What You Get

import {
  format,
  parseISO,
  addDays,
  addMonths,
  differenceInDays,
  isBefore,
  isWeekend,
  startOfDay,
  endOfMonth,
} from "date-light";
Area Utilities
Format & parse format, parseISO, parse
Add & subtract addDays, addMonths, addYears, addHours, subDays, more
Differences differenceInDays, differenceInMonths, differenceInYears
Compare isBefore, isAfter, isEqual, isSameDay, isSameMonth
Query isWeekend, isLeapYear, isValid, getDaysInMonth
Start & end startOfDay, endOfWeek, startOfMonth, endOfYear, more

Full list: API Reference

The Tradeoff

date-light is intentionally not a calendar platform. It does not include locales, timezone databases, duration objects, plugins, or chainable wrappers.

That is the point. For those jobs, use Intl, Temporal, Luxon, or date-fns directly. For common app date utilities, keep the dependency small.

Size

Library minzipped Note
date-light 3.11 KB 39 functions, fully tree-shakeable
dayjs 2.97 KB Core only
date-fns (20 functions) 18.34 KB Same common-operation comparison
date-fns (full) 261.3 KB Full package

date-light (39 functions) is 5.9x smaller than importing 20 comparable date-fns functions and remains close to dayjs core size while covering a broader utility surface.

Documentation

License

MIT 2026


Security Policy · Changelog · Code of Conduct · Contributing

About

Zero-dependency, ~3.11KB minzipped, fully typed date utility library

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

13 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors