Day.js parses, validates, manipulates, and formats dates and times in JavaScript. Its API is largely compatible with Moment.js patterns.
Overview
Day.js is a small JavaScript library aimed at modern browsers for working with dates and times. It handles parsing, validation, manipulation, and display of temporal values while staying close to familiar Moment.js-style APIs.
Operations return new immutable instances rather than mutating existing objects, which helps avoid accidental state changes. The API is chainable, and optional plugins extend core behavior without bundling unused code by default.
Internationalization is supported through separate locale modules that you load only when needed, so default builds stay minimal. Documentation on day.js.org covers installation, the API reference, plugin list, and localization guides.
If you already use Moment.js-style calls, the source material states that the same patterns largely apply to Day.js, with a much smaller download footprint emphasized in project messaging.
Key features
- Moment.js-compatible API patterns
- Immutable date instances
- Chainable API
- Optional plugin modules
- Internationalization via separate locales
- Small default bundle size
- Parse and validate dates
- Display and manipulate date-time values
Use cases
- Formatting dates in web apps
- Parsing user-entered dates
- Locale-aware date display
- Migrating from Moment.js-style code
- Lightweight browser date utilities