Skip to content

date-wiz

Zero-dependency. TypeScript-native. Under 2 KB gzipped.

Zero dependencies

Built purely on native Date and Intl. Nothing from npm reaches your users’ browsers.

TypeScript native

Full type safety, auto-complete for every option, and declaration maps. No @types/ package needed.

Tree-shakable ESM

Import only format() and ship ~1.2 KB. Bundlers drop everything else automatically.

Smart formatting

smartFormat() returns “Today at 4:30 PM”, “Yesterday at 11 AM”, or “Oct 12, 2022” — no config.

Business day logic

Add business days, count working days, SLA hour checks — with optional holiday exclusions.

Intelligent parsing

Understands +2d, next_monday, 20240515, and 15-05-2024 — no format string needed.

import { wiz, format, getRelativeTime, smartFormat } from 'date-wiz';
// Chainable
const deadline = wiz(new Date())
.add(3, 'businessDays')
.setHour(17)
.format('LLL');
// → "March 20, 2026 at 5:00 PM"
// Relative time with precision
getRelativeTime(twoDaysAgo, { precision: 2 });
// → "2 days, 4 hours ago"
// Context-aware label
smartFormat(new Date());
// → "Today at 2:30 PM"
// i18n — zero locale files bundled
format(new Date(), 'DD MMMM YYYY', 'bn-BD');
// → "১৫ মার্চ ২০২৬"