Installation
Package managers
Section titled “Package managers”npm install date-wizpnpm add date-wizyarn add date-wizbun add date-wizRequirements
Section titled “Requirements”| Environment | Minimum version |
|---|---|
| Node.js | 14.0.0 |
| TypeScript | 4.7 (for exports map support) |
| Browser | Any browser with Intl.RelativeTimeFormat (~96% global coverage) |
CDN (no build step)
Section titled “CDN (no build step)”Load date-wiz directly in a <script> tag via unpkg or jsDelivr:
<!-- unpkg --><script src="https://unpkg.com/date-wiz/dist/umd/index.js"></script>
<!-- jsDelivr --><script src="https://cdn.jsdelivr.net/npm/date-wiz/dist/umd/index.js"></script>
<script> const { format, getRelativeTime } = dateWiz; console.log(format(new Date(), 'DD MMM YYYY')); // "15 Mar 2026"</script>Verify the installation
Section titled “Verify the installation”import { format } from 'date-wiz';
console.log(format(new Date(), 'YYYY-MM-DD'));// → "2026-03-15"If this prints today’s date, you’re good to go.
TypeScript setup
Section titled “TypeScript setup”date-wiz ships its own .d.ts files — no separate @types/ package is needed. If your tsconfig.json uses "moduleResolution": "bundler" or "node16", sub-path imports will resolve automatically:
import { format } from 'date-wiz/format'; // ✅import { getRelativeTime } from 'date-wiz/relative'; // ✅import { addBusinessDays } from 'date-wiz/business'; // ✅For older "moduleResolution": "node" setups, import from the root instead:
import { format, getRelativeTime, addBusinessDays } from 'date-wiz';