# JavaScript date libraries

JavaScript date libraries parse, format, and calculate with dates beyond what the built-in Date object offers. These libraries handle the schedules, billing periods, and user-entered dates that web apps track across time zones.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [date-fns](#date-fns) | 469.0M | 36.7K | May 2026 | MIT |
| [Day.js](#day-js) | 422.6M | 48.6K | Aug 2026 | MIT |
| [d3-time](#dthree-time) | 393.8M | 237 | Nov 2026 | ISC |
| [Luxon](#luxon) | 226.8M | 16.5K | Sep 2025 | MIT |
| [Moment.js](#moment) | 199.0M | 47.9K | Sep 2026 | MIT |
| [dateformat](#dateformat) | 173.7M | 1.3K | Oct 2026 | MIT |
| [Fecha](#fecha) | 136.2M | 2.1K | Apr 2022 | MIT |
| [@internationalized/date](#internationalized-date) | 99.3M | 16.1K | Sep 2026 | Apache-2.0 |

Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[date-fns](#date-fns) has the most monthly downloads in this comparison, at 466.2M.

## Capabilities

| Library | Custom-format parsing | Named time zones |
| --- | --- | --- |
| [date-fns](#date-fns) | Yes | Via plugin |
| [Day.js](#day-js) | Via plugin | Via plugin |
| [d3-time](#dthree-time) | Via plugin | No |
| [Luxon](#luxon) | Yes | Yes |
| [Moment.js](#moment) | Yes | Via plugin |
| [dateformat](#dateformat) | No | No |
| [Fecha](#fecha) | Yes | No |
| [@internationalized/date](#internationalized-date) | No | Yes |

## Libraries

### date-fns

[GitHub](https://github.com/date-fns/date-fns) · [npm](https://www.npmjs.com/package/date-fns) · [Docs](https://date-fns.org/)

date-fns is a set of functions for the built-in Date object, in the browser and in Node.js. Each function takes a Date and returns a new one, so the input never changes, and the library never adds methods to Date itself. `format` turns a date into text from a pattern of Unicode tokens, and `compareAsc` orders dates for sorting. Every function imports on its own, so a bundler keeps only the functions an app calls. Calculations in a named time zone come from the separate `@date-fns/tz` package.

- Downloads / mo: 469.0M
- Stars: 36.7K
- Last release: 4.4.0
- License: MIT
- Capabilities: [From the date-fns docs](https://date-fns.org/)

**Strengths**

- **Takes native Date values.** Use date helpers without converting values into a wrapper object.
- **Supports selective imports.** Import the helpers and locales that the application needs.

**Watch out for**

- **Time zones need another package.** Install @date-fns/tz for calculations in a selected time zone.
- **Format tokens differ from Moment.** format and parse use Unicode tokens, so a Moment string such as YYYY-MM-DD becomes yyyy-MM-dd.

```sh
npm install date-fns
```

**react-component/picker** (306 stars)

[react-component/picker](https://github.com/react-component/picker) 

```javascript
const isStrictValidDate = (text: string, format: string, locale: string) => {
  const date = parse(text, format, locale);
  if (!isValid(date)) {
    return false;
  }
  const formattedDate = formatDate(date, format, { locale: getLocale(locale) });
  return text === formattedDate;
}

```

[src/generate/dateFns.ts](https://github.com/react-component/picker/blob/9ecb0508645e1c0d9f3181263eecafdd1e262f6b/src/generate/dateFns.ts#L65-L72) · [More projects using date-fns →](https://dashboard.exa.ai/playground/search?q=JavaScript%20TypeScript%20projects%20using%20date-fns%20for%20locale-aware%20parsing%2C%20strict%20validation%20and%20time-zone%20calculations&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
import { compareAsc, format } from "date-fns";

format(new Date(2014, 1, 11), "yyyy-MM-dd");

```

From [README.md](https://github.com/date-fns/date-fns/blob/main/README.md)

### Day.js

[GitHub](https://github.com/iamkun/dayjs) · [npm](https://www.npmjs.com/package/dayjs) · [Docs](https://day.js.org/)

Day.js parses, validates, changes, and formats dates through an API that is largely compatible with Moment.js. A call to `dayjs()` wraps a date in a Day.js object, and methods such as `add`, `startOf`, and `format` chain onto it. Every change returns a new object rather than editing the existing one. Locales and extra features load as plugins through `dayjs.extend`, and only the ones an app imports reach its bundle. Parsing a custom format and converting between named time zones both come from plugins.

- Downloads / mo: 422.6M
- Stars: 48.6K
- Last release: 1.11.23
- License: MIT
- Capabilities: [From the Day.js docs](https://day.js.org/)

**Strengths**

- **Follows the Moment.js API.** Chain parsing, date changes, and formatting through a similar API.
- **Keeps date operations immutable.** Receive a new Day.js instance when changing a date.

**Watch out for**

- **Strict validation needs a plugin.** Enable CustomParseFormat and pass the input format plus strict flag.
- **Default zone reaches tz calls only.** dayjs() keeps the local time zone after dayjs.tz.setDefault; only dayjs.tz() reads the default.

```sh
npm install dayjs
```

**react-component/picker** (306 stars)

[react-component/picker](https://github.com/react-component/picker) 

```javascript
(locale, text, formats) => {
      // Preserve Day.js fallback when the requested locale data is not registered.
      const localeStr = dayjs().locale(parseLocale(locale)).locale();
      for (let i = 0; i < formats.length; i += 1) {
        const format = formats[i];
        const formatText = text;
        if (format.includes('wo') || format.includes('Wo')) {
          // parse Wo
          const year = formatText.split('-')[0];
          const weekStr = formatText.split('-')[1];
          const firstWeek = dayjs(year, 'YYYY').startOf('year').locale(localeStr);
          for (let j = 0; j <= 52; j += 1) {
            const nextWeek = firstWeek.add(j, 'week');
            if (nextWeek.format('Wo') === weekStr) {
              return nextWeek;
            }
          }
          parseNoMatchNotice();
          return null;
        }
        const date = dayjs(formatText, format, localeStr, true);
        if (date.isValid()) {
          return date;
        }
      }

      if (text) {
        parseNoMatchNotice();
      }
      return null;
    }

```

[src/generate/dayjs.ts](https://github.com/react-component/picker/blob/9ecb0508645e1c0d9f3181263eecafdd1e262f6b/src/generate/dayjs.ts#L167-L197) · [More projects using Day.js →](https://dashboard.exa.ai/playground/search?q=JavaScript%20TypeScript%20projects%20using%20dayjs%20for%20locale-aware%20parsing%2C%20strict%20validation%20and%20time-zone%20calculations&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
const dayjs = require('dayjs')
//import dayjs from 'dayjs' // ES 2015
dayjs().format()

```

From [node-js.md](https://github.com/dayjs/dayjs-website/blob/master/docs/installation/node-js.md)

### d3-time

[GitHub](https://github.com/d3/d3-time) · [npm](https://www.npmjs.com/package/d3-time) · [Docs](https://d3js.org/d3-time)

d3-time does calendar math on top of the built-in Date. It rounds a date to a boundary, counts the boundaries between two dates, and lists them. Each interval, such as day, week, or month, has `floor`, `ceil`, `count`, and `range` methods. Counting days with the day interval stays correct across a daylight saving change, where subtracting timestamps and dividing by the length of a day gives a fraction. The module has no calendar system of its own and ignores leap seconds. Formatting and parsing live in a separate time format module.

- Downloads / mo: 393.8M
- Stars: 237
- Last release: 3.1.1
- License: ISC
- Capabilities: [From the d3-time docs](https://d3js.org/d3-time)

**Watch out for**

- **Local time and UTC only.** Intervals work in the local time zone and UTC, with no named time zones.

```sh
npm install d3-time
```

**vega/vega** (12.1K stars)

[vega/vega](https://github.com/vega/vega) 

```javascript
export function localISOWeekYear(d) {
  return timeDay.offset(timeMonday.floor(d), 3).getFullYear();
}

```

[packages/vega-time/src/util.js](https://github.com/vega/vega/blob/3f2a7973cb3677621c552e409e99a967fc64bd2b/packages/vega-time/src/util.js#L33-L35) · [More projects using d3-time →](https://dashboard.exa.ai/playground/search?q=d3-time%20GitHub%20projects)

**Quickstart**

```javascript
import { timeDay } from "d3-time";

const start = new Date(2015, 2, 1);
const end = new Date(2015, 3, 1);
console.log(timeDay.count(start, end));

```

From [time docs](https://github.com/d3/d3/blob/main/docs/d3-time.md)

### Luxon

[GitHub](https://github.com/moment/luxon) · [npm](https://www.npmjs.com/package/luxon) · [Docs](https://moment.github.io/luxon/)

Luxon represents time with three immutable types of its own: `DateTime` for a moment, `Duration` for a length of time, and `Interval` for the span between two moments. Methods chain, so `DateTime.now().setZone('America/New_York')` moves the current time into that zone and later calls build on the result. Time zones and locales come from the runtime's Intl API, so the package ships no zone or locale files. `DateTime.fromFormat` parses text against a custom format, and `toISO` writes a DateTime back out as an ISO string.

- Downloads / mo: 226.8M
- Stars: 16.5K
- Last release: 3.7.2
- License: MIT
- Capabilities: [From the Luxon docs](https://moment.github.io/luxon/)

**Strengths**

- **Includes duration and interval types.** Represent elapsed spans and intervals alongside DateTime values.
- **Uses native locale and zones.** Use the runtime’s Intl data instead of shipping separate locale files.

**Watch out for**

- **Custom parsing matches formats strictly.** DateTime.fromFormat accepts only text that matches the format exactly.
- **Locale parsing depends on Intl.** Locale-specific format strings come from the runtime's Intl data and can differ between environments.

```sh
npm install luxon
```

**react-component/picker** (306 stars)

[react-component/picker](https://github.com/react-component/picker) 

```javascript
(locale, date, format) => {
      if (!date || !date.isValid) {
        return null;
      }

      return date.setLocale(normalizeLocale(locale)).toFormat(normalizeFormat(format));
    }

```

[src/generate/luxon.ts](https://github.com/react-component/picker/blob/9ecb0508645e1c0d9f3181263eecafdd1e262f6b/src/generate/luxon.ts#L114-L120) · [More projects using Luxon →](https://dashboard.exa.ai/playground/search?q=JavaScript%20TypeScript%20projects%20using%20luxon%20for%20locale-aware%20parsing%2C%20strict%20validation%20and%20time-zone%20calculations&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
import { DateTime } from "luxon";

console.log(DateTime.now().toISO());

```

From [install.md](https://github.com/moment/luxon/blob/master/docs/install.md)

### Moment.js

[GitHub](https://github.com/moment/moment) · [npm](https://www.npmjs.com/package/moment) · [Docs](https://momentjs.com/docs/)

Moment.js parses, validates, changes, and formats dates through a `moment` object that wraps a Date. It runs in browsers and in Node.js. Format strings use tokens such as `YYYY-MM-DD`, and parsing accepts a format and a locale. Named time zones come from the separate moment-timezone package and its zone data. The project is in maintenance mode and accepts no new features.

- Downloads / mo: 199.0M
- Stars: 47.9K
- Last release: 2.31.0
- License: MIT
- Capabilities: [From the Moment.js docs](https://momentjs.com/docs/)

**Watch out for**

- **In maintenance mode.** The project accepts no new features. Named time zones need the separate moment-timezone package.

```sh
npm install moment
```

**react-component/picker** (306 stars)

[react-component/picker](https://github.com/react-component/picker) 

```javascript
(date) => {
    const clone = date.clone().locale('en_US');
    return clone.weekday() + clone.localeData().firstDayOfWeek();
  }

```

[src/generate/moment.ts](https://github.com/react-component/picker/blob/9ecb0508645e1c0d9f3181263eecafdd1e262f6b/src/generate/moment.ts#L14-L17) · [More projects using Moment.js →](https://dashboard.exa.ai/playground/search?q=moment%20GitHub%20projects)

**Quickstart**

```javascript
const moment = require('moment');

moment().format();

```

From [node-js.md](https://github.com/moment/momentjs.com/blob/master/docs/moment/00-use-it/01-node-js.md)

### dateformat

[GitHub](https://github.com/felixge/node-dateformat) · [npm](https://www.npmjs.com/package/dateformat)

dateformat turns a Date into text from a mask, a pattern of letters such as `dddd, mmmm dS, yyyy`. Named masks cover common layouts, among them `isoDateTime` and `fullDate`, and new ones can be added to the exported `masks` object. Passing `true` as a third argument, or starting a mask with `UTC:`, prints the time in UTC. The package formats only and has no function for parsing text back into a Date. It also installs a `dateformat` command for the terminal.

- Downloads / mo: 173.7M
- Stars: 1.3K
- Last release: 5.0.5
- License: MIT
- Capabilities: [From the dateformat docs](https://github.com/felixge/node-dateformat)

```sh
npm install dateformat
```

**appium/appium** (22.2K stars)

[appium/appium](https://github.com/appium/appium) 

```javascript
function timestamp () {
  let date = new Date();
  if (!timeZone) {
    date = new Date(date.valueOf() + date.getTimezoneOffset() * 60000);
  }
  return dateformat(date, "yyyy-mm-dd HH:MM:ss:l");
}

```

[lib/logsink.js](https://github.com/appium/appium/blob/bc358d31b93cd1ce4b922e51634263adacc54c15/lib/logsink.js#L40-L46) · [More projects using dateformat →](https://dashboard.exa.ai/playground/search?q=dateformat%20GitHub%20projects)

**Quickstart**

```javascript
import dateFormat, { masks } from "dateformat";
const now = new Date();

// Basic usage
dateFormat(now, "dddd, mmmm dS, yyyy, h:MM:ss TT");

```

From [Readme.md](https://github.com/felixge/node-dateformat/blob/master/Readme.md)

### Fecha

[GitHub](https://github.com/taylorhakes/fecha) · [npm](https://www.npmjs.com/package/fecha)

Fecha formats and parses dates and leaves out date arithmetic, as a replacement for the formatting and parsing parts of Moment.js. `format` takes a Date or a timestamp and a format string such as `dddd MMMM Do, YYYY`, and returns text. Named formats such as `isoDate` and `mediumDate` are built in. `parse` reads a string against a required format and returns a Date or null.

- Downloads / mo: 136.2M
- Stars: 2.1K
- Last release: 4.2.3
- License: MIT
- Capabilities: [From the Fecha docs](https://github.com/taylorhakes/fecha)

**Watch out for**

- **No date arithmetic.** Fecha formats and parses only; adding or subtracting time needs another library.

```sh
npm install fecha
```

**benitolopez/hotel-datepicker** (325 stars)

[benitolopez/hotel-datepicker](https://github.com/benitolopez/hotel-datepicker) 

```javascript
parseDisabledDates() {
    // Sort disabled dates and store it in property
    const _tmp = [];
    this.setFechaI18n();
    for (let i = 0; i < this.disabledDates.length; i++) {
        _tmp[i] = fecha.parse(this.disabledDates[i], "YYYY-MM-DD");
    }

    _tmp.sort((a, b) => {
        return a - b;
    });

    this.disabledDatesTime = _tmp;
}

```

[src/js/hotel-datepicker.js](https://github.com/benitolopez/hotel-datepicker/blob/5cc8e0def9c0f96fbcea19840a3a61a98ee05c78/src/js/hotel-datepicker.js#L2552-L2565) · [More projects using Fecha →](https://dashboard.exa.ai/playground/search?q=fecha%20GitHub%20projects)

**Quickstart**

```javascript
import { format } from 'fecha';

format(new Date(2015, 10, 20), 'dddd MMMM Do, YYYY'); // 'Friday November 20th, 2015'

```

From [README.md](https://github.com/taylorhakes/fecha/blob/master/README.md)

### @internationalized/date

[GitHub](https://github.com/adobe/react-spectrum) · [npm](https://www.npmjs.com/package/@internationalized/date) · [Docs](https://react-spectrum.adobe.com/internationalized/date/)

@internationalized/date represents dates and times with immutable objects tied to a calendar system. `CalendarDate` holds a date with no time, `CalendarDateTime` adds a time without a zone, and `ZonedDateTime` holds a date and time in a specific time zone. The package supports thirteen calendar systems, including Gregorian, Buddhist, Islamic, and Persian, and converts values between calendars, time zones, and strings. Operations that could be ambiguous, such as arithmetic across a daylight saving change, resolve the ambiguity explicitly. The design follows Temporal, the date API proposed for JavaScript itself.

- Downloads / mo: 99.3M
- Stars: 16.1K
- Last release: 3.12.4
- License: Apache-2.0
- Capabilities: [From the @internationalized/date docs](https://react-spectrum.adobe.com/internationalized/date/)

```sh
npm install @internationalized/date
```

**chakra-ui/zag** (5.3K stars)

[chakra-ui/zag](https://github.com/chakra-ui/zag) 

```javascript
function createRegex(locale: string, timeZone: string) {
  const formatter = new DateFormatter(locale, { day: "numeric", month: "numeric", year: "numeric", timeZone })
  const parts = formatter.formatToParts(new Date(2000, 11, 25))
  return parts.map(({ type, value }) => (type === "literal" ? `${value}?` : `((?!=<${type}>)\\d+)?`)).join("")
}

```

[packages/utilities/date-utils/src/parse-date.ts](https://github.com/chakra-ui/zag/blob/f6f33ea8dc5017baec830f71c2b835a36db196ed/packages/utilities/date-utils/src/parse-date.ts#L39-L43) · [More projects using @internationalized/date →](https://dashboard.exa.ai/playground/search?q=%40internationalized/date%20GitHub%20projects)

**Quickstart**

```javascript
import {CalendarDate, startOfWeek} from '@internationalized/date';

let date = new CalendarDate(2022, 2, 3);
date = date.add({weeks: 1});
date = startOfWeek(date, 'en-US');
date.toString(); // 2022-02-06

```

From [README.md](https://github.com/adobe/react-spectrum/blob/main/packages/@internationalized/date/README.md)

## FAQ

### Which JavaScript date library should I use?

For functions that work on native Date values, use [date-fns](#date-fns). For a chainable API that matches Moment.js, use [Day.js](#day-js). For named time zones, durations, and intervals in the core package, use [Luxon](#luxon), and for calendars other than Gregorian, use [@internationalized/date](#internationalized-date).

### How do I format a date in JavaScript?

With [date-fns](#date-fns), `format(date, 'yyyy-MM-dd')` returns the date as text in that pattern. [Day.js](#day-js) chains the same step as `dayjs(date).format('YYYY-MM-DD')`. Without a library, `Intl.DateTimeFormat` formats a Date for a locale but takes no custom pattern.

### Day.js vs date-fns: what is the difference?

[Day.js](#day-js) wraps each date in its own object and chains methods in the style of Moment.js. [date-fns](#date-fns) is a set of separate functions that take and return native Date values, so a bundler keeps only the functions an app imports. Both return a new value instead of changing the original.

### Luxon vs date-fns: which should I use?

[Luxon](#luxon) has its own DateTime, Duration, and Interval types and handles named time zones in the core package through the runtime's Intl API. [date-fns](#date-fns) works on native Date values and adds time zone calculations through the separate @date-fns/tz package.

### Day.js vs Moment.js: what changed?

[Day.js](#day-js) copies most of the Moment.js API, so most Moment code reads the same. Day.js returns a new object on every change, and its locales and extra features load as plugins. [Moment.js](#moment) is in maintenance mode and accepts no new features.

### How do time zones work in date-fns?

Install @date-fns/tz. Its `TZDate` class extends Date and performs every calculation in a given time zone rather than the system zone, so date-fns functions accept it like any other Date.

## How this page was built

Data checked Nov 19, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best JavaScript date libraries date-fns Day.js Luxon Temporal timezone parsing formatting durations code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
