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.
| Metric | date-fns | dayjs | Difference |
|---|---|---|---|
| Weekly downloads | 72,360,904 | 51,515,684 | date-fns +40% |
| 12-month download growth | +129% | +95% | date-fns +33 pts |
| Gzip size | - | - | - |
| Minified size | - | - | - |
| Dependencies | 0 | 0 | Same |
| Unpacked size | 10.4 MB | 666 kB | dayjs 16.0x smaller |
| Latest release | 4.4.0, 29 May 2026 | 1.11.23, 17 Aug 2026 | dayjs 3 months more recent |
| Releases, last 12 months | 4 | 5 | dayjs 1 more |
| First published | 6 Oct 2014 | 10 Apr 2018 | date-fns 3.5 years earlier |
| GitHub stars | 36,646 | 48,667 | dayjs +33% |
| Open issues | 665 | 971 | dayjs 306 more |
| Open pull requests | 353 | 365 | dayjs 12 more |
| Contributors | 431 | 358 | date-fns +20% |
| Commits, last 52 weeks | 316 | 54 | date-fns 5.9x higher |
| TypeScript types | Bundled | Bundled | Same |
| Module format | ESM + CommonJS | CommonJS | Differs |
| Runtimes | Browser, Node.js | Browser, Node.js | Same |
| License | MIT | MIT | Same |
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-fns
- 0.1.06 Oct 2014
- 1.0.018 May 2016
- 2.0.020 Aug 2019
- 3.0.018 Dec 2023
- 4.0.016 Sept 2024
- 4.4.029 May 2026
- 4.3.022 May 2026
- 4.2.118 May 2026
- 4.2.018 May 2026
- 4.1.017 Sept 2024
dayjs
- 1.0.010 Apr 2018
- 1.11.2317 Aug 2026
- 1.11.2216 Aug 2026
- 1.11.2126 May 2026
- 1.11.2012 Mar 2026
- 1.11.1931 Oct 2025
Standalone functions, tree-shakeable
Chainable, immutable wrapper object
Format a date as YYYY-MM-DD, add 7 days, and count the days between two dates
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)); // 91import 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")); // 91Both snippets were run with Node.js, ES module on 25 Sept 2026 against the versions shown and printed the output in the comments.
- 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.
- 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.
- date-fns vs luxon60 searches/mo
- dayjs vs moment40 searches/mo
- date-fns vs moment30 searches/mo
- luxon vs dayjs20 searches/mo
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").