Format a date
Format, parse, and work with dates across locales and timezones.
Options for this task
@internationalized/date
Library / toolDate and time objects for calendars, timezones, and internationalized interfaces.
- Good for
- Building date controls that need explicit calendar and timezone behavior.
Chrono
Library / toolA parser that recognizes dates expressed in natural language.
- Good for
- Turning phrases such as next Friday into structured date information.
date-fns
Date utilitiesFunctions for formatting, parsing, and manipulating JavaScript dates.
- Good for
- Picking individual functions for the date operations you need.
- Keep in mind
- Date calculations and formatting, rather than a date picker UI.
Day.js
Date utilitiesA compact date library with a chainable API.
- Good for
- Working with dates through a familiar, chainable API.
- Keep in mind
- Add plugins for capabilities beyond the core.
pretty-ms
Library / toolA formatter that converts milliseconds into readable durations.
- Good for
- Showing elapsed time and task durations in interfaces or logs.
Spacetime
Library / toolDate and time utilities with timezone-aware manipulation.
- Good for
- Working with dates across timezones using a chainable interface.
Before you decide
Try a small, realistic example. Check the runtime, accessibility, maintenance, and license requirements for the features you need.