Skip to content
date-and-time

The simplest, most intuitive date and time library

Modern TypeScript library for date manipulation with full ES Modules support.

Features

Modern & Fast

Written in TypeScript with ES2021 target. Tree-shakable modules for optimal bundle size.

Internationalization

Support for 40+ locales and multiple calendar systems. Arabic, Bengali, Myanmar numerals.

Timezone Support

Complete timezone handling with IANA timezone database built-in.

Type Safe

Full TypeScript support with comprehensive type definitions and IntelliSense.

Tree Shakable

Import only what you need. Optimized for modern bundlers with sideEffects false.

Plugin System

Extensible plugin system allows you to extend formatters and parsers.

Quick Example

import { format, parse, addDays } from 'date-and-time';
import ja from 'date-and-time/locales/ja';
const now = new Date();
// Basic formatting
format(now, 'YYYY/MM/DD HH:mm:ss');
// => 2025/08/23 14:30:45
// Localized formatting
format(now, 'YYYY年M月D日(ddd)', { locale: ja });
// => 2025年8月23日(金)
// Timezone-aware formatting
format(now, 'YYYY-MM-DD HH:mm:ss [EST]', { timeZone: 'America/New_York' });
// => 2025-08-23 09:30:45 EST
// Parsing
const date = parse('2025/08/23 14:30:45', 'YYYY/MM/DD HH:mm:ss');
console.log(date)
// Date arithmetic
const futureDate = addDays(now, 7);
console.log(format(futureDate, 'YYYY/MM/DD'));

Key Features in v4.x

  • Complete TypeScript rewrite with enhanced type safety
  • Tree-shaking support for better bundle optimization
  • Integrated timezone and timespan plugins into the core library
  • Modern JavaScript targeting ES2021 (Node.js ≥18 required)
  • Enhanced API with options objects instead of boolean flags
  • Improved locale handling with per-function locale specification

Browser & Environment Support

  • Node.js: 18+
  • Browsers: Chrome 85+, Firefox 78+, Safari 14+, Edge 85+
  • Module Systems: ES Modules, CommonJS
  • TypeScript: 4.5+

Installation

Terminal window
npm install date-and-time

Community