datezone
v1.0.7
Published
A lightweight and comprehensive date and timeZone utility library for JavaScript.
Maintainers
Readme
datezone
🚀 Why Datezone?
- Extreme Performance: Up to 1,000x faster than date-fns for timeZone operations (see benchmarks)
- Faster by Design: Uses timestamp math instead of creating
Dateobjects, minimizing allocations and saving work for the garbage collector - Timezone-First: All functions accept an optional
timeZoneparameter - Zero Unnecessary Objects: Avoids creating
Dateobjects unless needed - Tree-Shakeable: Import only what you need
- Pure & Typed: No side effects, strict TypeScript types
- Modern: Built on the Intl API for accuracy and speed
Installation
# Bun
bun add datezone
# pnpm
pnpm add datezone
# npm
npm install datezoneQuick Start
import { startOfDay, addDays, format } from "datezone";
const now = Date.now();
const startNY = startOfDay(now, "America/New_York");
const tomorrow = addDays(now, 1, "Europe/London");
const formatted = format(now, "yyyy-MM-dd HH:mm:ss zzzz", { locale: "en", timeZone: "America/New_York" });API Reference
See Docs for all exports and usage.
Performance
| Operation | Datezone | date-fns | Improvement | |-----------|----------|----------|-------------| | addDays (DST) | 3.9M ops/sec | 174.0K ops/sec | +2150% | | startOfDay (DST) | 2.3M ops/sec | 186.5K ops/sec | +1150% | | endOfDay (DST) | 2.4M ops/sec | 188.7K ops/sec | +1158% | | dayOfYear (DST) | 16.4M ops/sec | 40.2K ops/sec | +40630% | | format (DST) | 911.4K ops/sec | 114.6K ops/sec | +695% | | addMonths (DST) | 2.1M ops/sec | 106.7K ops/sec | +1833% | | addWeeks (DST) | 2.0M ops/sec | 178.0K ops/sec | +1001% | | addYears (DST) | 8.5M ops/sec | 106.5K ops/sec | +7868% | | intervalToDuration (DST) | 2.5M ops/sec | 11.5K ops/sec | +21971% |
Summary:
- Datezone wins: 77 operations (87.5%)
- date-fns wins: 5 operations (5.7%)
- Close matches: 6 operations (6.8%)
See the full performance report → for all details and methodology.
Why Choose Datezone?
| vs. date-fns | vs. Luxon/Day.js | vs. Temporal | |--------------|------------------|-------------| | ✅ Much faster timeZone ops | ✅ No object wrappers | ✅ Available today | | ✅ Explicit timeZone handling | ✅ Tree-shakeable | ✅ Proven performance | | ✅ Modern Intl API | ✅ Smaller bundle size | |
Contributing
See our Contributing Guide.
License
MIT
⭐ Star us on GitHub if Datezone makes your app faster!
