Skip to content
JS
Comparison

date-fns vs dayjs

date-fns is a collection of standalone functions for working with native JavaScript Date objects, and dayjs is a date library with a largely Moment.js-compatible API, extended through plugins.

Date and timePackage data 25 Sept 2026
date-fnsv4.4.0, 29 May 2026

Collection of standalone functions for working with native JavaScript Date objects.

$ npm install date-fns
dayjsv1.11.23, 17 Aug 2026

Date library with a largely Moment.js-compatible API, extended through plugins.

$ npm install dayjs
Metricdate-fnsdayjsDifference
Weekly downloads72,360,90451,515,684date-fns +40%
12-month download growth+129%+95%date-fns +33 pts
Gzip size---
Minified size---
Dependencies00Same
Unpacked size10.4 MB666 kBdayjs 16.0x smaller
Latest release4.4.0, 29 May 20261.11.23, 17 Aug 2026dayjs 3 months more recent
Releases, last 12 months45dayjs 1 more
First published6 Oct 201410 Apr 2018date-fns 3.5 years earlier
GitHub stars36,64648,667dayjs +33%
Open issues665971dayjs 306 more
Open pull requests353365dayjs 12 more
Contributors431358date-fns +20%
Commits, last 52 weeks31654date-fns 5.9x higher
TypeScript typesBundledBundledSame
Module formatESM + CommonJSCommonJSDiffers
RuntimesBrowser, Node.jsBrowser, Node.jsSame
LicenseMITMITSame

Green marks the smaller size or the more recent release. Bold marks the higher count, with no judgement implied. Sizes are for the whole package per Bundlephobia. Growth compares the average of the last 4 weeks with the first 4 weeks of the 52-week series.

date-fns72.4m latest weekdayjs50.9m latest week
Week of 23 Sept 2025Week of 15 Sept 2026
Weekly npm downloads, 52 weeks. Y axis starts at zero. Values are not smoothed.

date-fns

Major versions
  1. 0.1.06 Oct 2014
  2. 1.0.018 May 2016
  3. 2.0.020 Aug 2019
  4. 3.0.018 Dec 2023
  5. 4.0.016 Sept 2024
Last 5 releases
  1. 4.4.029 May 2026
  2. 4.3.022 May 2026
  3. 4.2.118 May 2026
  4. 4.2.018 May 2026
  5. 4.1.017 Sept 2024
137 releases in total, 4 in the last 12 months

dayjs

Major versions
  1. 1.0.010 Apr 2018
Last 5 releases
  1. 1.11.2317 Aug 2026
  2. 1.11.2216 Aug 2026
  3. 1.11.2126 May 2026
  4. 1.11.2012 Mar 2026
  5. 1.11.1931 Oct 2025
132 releases in total, 5 in the last 12 months
date-fns

Standalone functions, tree-shakeable

dayjs

Chainable, immutable wrapper object

Format a date as YYYY-MM-DD, add 7 days, and count the days between two dates

date-fns@4.4.0
import { format, addDays, differenceInDays } from "date-fns";

const d = new Date(2026, 8, 25); // months are 0-based
console.log(format(d, "yyyy-MM-dd")); // 2026-09-25
console.log(format(addDays(d, 7), "yyyy-MM-dd")); // 2026-10-02
console.log(differenceInDays(new Date(2026, 11, 25), d)); // 91
dayjs@1.11.23
import dayjs from "dayjs";

const d = dayjs("2026-09-25");
console.log(d.format("YYYY-MM-DD")); // 2026-09-25
console.log(d.add(7, "day").format("YYYY-MM-DD")); // 2026-10-02
console.log(dayjs("2026-12-25").diff(d, "day")); // 91

Both snippets were run with Node.js, ES module on 25 Sept 2026 against the versions shown and printed the output in the comments.

date-fns
  • Functions operate on the native Date type and do not extend core objects.
  • Pure functions that always return a new date instance.
  • v4 added time zone support through the separate @date-fns/tz package, which provides TZDate.
  • Written in TypeScript. Locales are imported individually.
dayjs
  • Immutable and chainable. The README describes the API as largely Moment.js-compatible.
  • Extra features are added through plugins loaded with dayjs.extend().
  • Time zone support comes from the utc and timezone plugins.
  • Locales are loaded on demand and are not included unless imported.
  • Need no runtime dependenciesBoth
  • Need both ESM and CommonJS entry pointsdate-fns (date-fns: ESM + CommonJS; dayjs: CommonJS)
  • Need to load it with require()Both
  • Need TypeScript types in the package itselfBoth
  • Need the more recent releasedayjs (1.11.23 on 17 Aug 2026 vs 4.4.0 on 29 May 2026)
  • Higher weekly npm downloadsdate-fns (72.4m vs 51.5m)

Each line is generated from the data above.

Code examples: run on 25 Sept 2026 against dayjs@1.11.23 and date-fns@4.4.0.

Indexability: Indexed: 100 US searches/month across both orderings ("date-fns vs dayjs", "dayjs vs date-fns").