Guides / Start
Installation
Add Native Dates in one command, with an optional polyfill for Safari and older Node releases.
Native Dates is an ES module package with bundled TypeScript types and zero runtime dependencies.
Install
Install from npm, or use the setup command if you work with a coding agent:
npm i native-datesnpx @native-dates/setup@latestThen import from native-dates in your app:
import { date, now, today } from 'native-dates';
const due = today().plus(2, 'weeks');
const current = now('Europe/Berlin');
const standup = date('2026-11-16').at('9:30am', 'America/Los_Angeles');
standup.format('YYYY-MM-DD HH:mm'); // '2026-11-16 09:30'Supporting Safari and older Node
Native Dates runs directly on the platform’s built-in Temporal and Intl APIs. Current releases of Chrome, Edge, Firefox, Node 26+, Deno, and Bun need nothing else.
For Safari, older browsers, or Node 22–25, install the polyfill alongside temporal-polyfill:
npm i @native-dates/polyfill temporal-polyfillImport it once at the top of your entry file before loading date code:
import '@native-dates/polyfill';
import { today } from 'native-dates';
const launch = today().plus(30, 'days');Zero cost on modern browsers
Runtimes with native Temporal and Intl.DurationFormat skip downloading either polyfill altogether.
Compatibility notes for older runtimes
- Synchronous loading: If an imported module evaluates dates at load time before top-level
awaitsettles, import@native-dates/polyfill/syncinstead. - Formatting durations on Node 22–23:
@native-dates/polyfillincludes a zero-dependencyIntl.DurationFormatfallback soDuration.format()andDuration.textwork on Node 22–23 as well (browsers and Node 24+ ship it natively and never download it).
Next, read Customization to tailor defaults and add optional plugins.