date-fns vs Day.js
date-fns vs Day.js compared for 2026: date-fns 4.4 (pure functions on native Date, time zones via @date-fns/tz) vs Day.js 1.11.23 (a 2 kB Moment-style chainable object with plugins). Includes bundle sizes, Node import time, parse/format/arithmetic speed, invalid-date handling and a DST bug we reproduced in Day.js's timezone plugin.
Quick Answer
date-fns and Day.js are the two date libraries most JavaScript teams pick between now that Moment.js is in maintenance. date-fns 4.4.0 (29 May 2026) is a collection of about 250 standalone functions that take and return native Date objects; since v4 it handles time zones through the separate @date-fns/tz package (TZDate) and an `in` option on every relevant function. Day.js 1.11.23 (17 August 2026) wraps a date in an immutable, chainable object with a largely Moment.js-compatible API, keeps the core small and moves everything else (UTC, time zones, custom parse formats, relative time, extra format tokens) into 37 plugins. In our runs on 28 November 2026 Day.js produced smaller bundles (3.4 kB vs 5.8 kB gzipped for format + addDays), imported in 5-7 ms against 501-584 ms for the full date-fns ESM entry in Node, and parsed and formatted faster. date-fns was about 7x faster at date arithmetic, rejected impossible dates such as 2026-02-30 instead of rolling them over, threw on Moment-style tokens like YYYY, and got DST arithmetic right in every host time zone, where Day.js's timezone plugin printed the wrong UTC offset after add() across a DST change and gave a different instant depending on the server's own time zone.
Last updated November 28, 2026. Covers date-fns 4.4.0 (29 May 2026) with @date-fns/tz 1.5.0 and Day.js 1.11.23 (17 August 2026); package metadata, changelogs, docs and repository data read on 28 November 2026, plus bundle, import, throughput, parsing and DST runs we did that day.
| Feature | date-fns | Day.js |
|---|---|---|
| Licence & Repository | MIT; date-fns/date-fns, ~36.7k stars | MIT; iamkun/dayjs, ~48.6k stars |
| Latest Release (Nov 2026) | 4.4.0 on 29 May 2026 (5.0.0-alpha.0 the same day) | 1.11.23 on 17 Aug 2026 |
| Programming Model | Pure functions on native Date; returns new Date/TZDate | Immutable chainable wrapper object, Moment-style |
| Install Footprint | 0 deps; 10.9 MB unpacked, 5,136 files | 0 deps; 682 KB unpacked, 451 files |
| Tree-shaking / Bundle Model | One module per function, ESM-first, tree-shakes | One core object; plugins and locales are separate imports |
| TypeScript Types | Written in TypeScript, bundled | Bundled index.d.ts (plugins augment the type) |
| Parsing Strings | parseISO for ISO 8601; parse(str, pattern, ref) for everything else | ISO 8601 in core; other formats via customParseFormat plugin |
| Impossible Dates (2026-02-30) | Invalid Date (isValid false) | Rolls over: 2026-02-30 becomes 2026-03-02 (strict mode needs customParseFormat) |
| Format Tokens | Unicode tokens (yyyy, dd); throws on YYYY/DD | Moment-style (YYYY, DD); z/zzz need advancedFormat + timezone |
| Time Zone Support | @date-fns/tz 1.5.0: TZDate and the `in` option (since v4.0) | utc + timezone plugins (Intl-based), dayjs.tz() |
| DST-safe Arithmetic in a Time Zone | Yes: same result on every host time zone in our run | No: wrong offset printed after add() across DST in our run |
| Locales | 96 locales, imported individually | 145 locale files, loaded on demand |
| Extensibility | Compose functions; no plugin system needed | Plugin system (37 official plugins) |
| Moment.js Migration | Different API and tokens; a rewrite of call sites | Largely Moment-compatible API |
| Release Activity (2026) | 4.2.0 to 4.4.0 in May 2026; repo pushed 26 Oct 2026 | 1.11.20 to 1.11.23 in 2026; repo pushed 6 Nov 2026 |
| Our Run: format + addDays bundle (min / gzip) | 20,001 B / 5,789 B | 7,781 B / 3,389 B |
| Our Run: time zone bundle (min / gzip) | 24,964 B / 7,303 B (with @date-fns/tz) | 12,339 B / 4,999 B (with utc + timezone) |
| Our Run: Node import time | 501-584 ms root ESM; 64-79 ms subpaths; 47-58 ms require() | 5-7 ms |
| Our Run: 500k add 3 days + start of month | 104-108 ms | 673-830 ms |
| Our Run: 50k time zone formats | 467-557 ms (TZDate + format) | 3,119-3,503 ms (.tz() + format) |
date-fns
date-fns is a library of standalone functions for JavaScript dates: format, parseISO, addDays, differenceInCalendarDays, startOfWeek, isValid and about 250 more, each importable on its own. Functions take native Date objects (or numbers and strings) and return new values, so nothing is mutated and nothing wraps your dates. The package is written in TypeScript and ships its own types. Version 4.0 (September 2024) added first-class time zone support: install @date-fns/tz and either create a TZDate in a given IANA zone or pass `{ in: tz('Asia/Tokyo') }` to any function, and the calculation happens in that zone. The 2026 releases were maintenance: 4.2.0 started pointing JSDoc at the Temporal API, 4.3.0 fixed locale bugs, and 4.4.0 (29 May 2026) moved the CDN scripts into a new @date-fns/cdn package, cutting the zipped package from 5.83 MB to 3.96 MB, with a 5.0 alpha removing them entirely. date-fns is MIT-licensed, has no dependencies and about 36.7k GitHub stars.
Pros
- Correct time zone arithmetic: addDays on a TZDate across the 8 March 2026 US DST change gave 12:00 -04:00, the same instant on UTC, Asia/Kolkata and America/New_York hosts
- Strict by default: parseISO('2026-02-30') and parse('31/02/2026', 'dd/MM/yyyy') returned Invalid Date instead of rolling over to March
- Catches Moment-style token mistakes: format(date, 'YYYY-MM-DD') throws a RangeError telling you to use yyyy and dd
- Fastest at arithmetic in our run: 500,000 'add 3 days then start of month' operations in 104-108 ms against 673-830 ms for Day.js
- Works on native Date objects, so values pass straight to JSON, ORMs, date pickers and Intl without unwrapping
- Per-function imports and real tree-shaking; TypeScript types written with the source
Cons
- Bigger bundles for simple use: format() pulls in the en-US locale and all formatters, 20.0 kB minified / 5.8 kB gzipped against 7.8 / 3.4 kB for Day.js
- Importing the root 'date-fns' entry as ESM in Node took 501-584 ms in our run (about 250 files); subpath imports took 64-79 ms and require() 47-58 ms
- Large install: 10.9 MB unpacked and 5,136 files in 4.4.0, even after the CDN cleanup
- Unicode format tokens (yyyy, dd, RRRR) trip up anyone coming from Moment.js
- Time zones need a second package (@date-fns/tz) and understanding TZDate versus plain Date
Best For
TypeScript applications and Node.js services that do real date arithmetic: scheduling, billing periods, reporting buckets, anything that has to be right in a user's time zone across DST changes.
Day.js
Day.js describes itself as a fast 2 kB alternative to Moment.js with a largely Moment.js-compatible API. You call dayjs(value) to get an immutable wrapper object and chain methods on it: dayjs().startOf('month').add(1, 'day').format('YYYY-MM-DD'). The core covers parsing ISO 8601 strings, getters and setters, add/subtract, startOf/endOf, diff, comparison and formatting; anything beyond that is a plugin you register once with dayjs.extend(): utc and timezone for time zones (timezone depends on utc and uses the Intl API), customParseFormat for non-ISO input and strict parsing, advancedFormat for tokens such as z and Do, relativeTime for 'in 3 hours', plus duration, isoWeek and others, 37 in the 1.11.23 package. Locales (145 files) load on demand. TypeScript types ship in the package. The 2026 releases were bug fixes, including a timezone plugin offset fix in 1.11.22 (16 August 2026). Day.js 1.11.23 came out on 17 August 2026, is MIT-licensed, has no dependencies and about 48.6k GitHub stars.
Pros
- Small bundles: format + add was 7.8 kB minified / 3.4 kB gzipped, and the time zone setup 12.3 / 5.0 kB, the smallest in every case we built
- Near-instant import in Node: 5-7 ms
- Familiar Moment.js API and tokens (YYYY-MM-DD), so Moment migrations are mostly mechanical
- Fast parsing and formatting in our run: 500,000 ISO parses in 136-192 ms (date-fns 666-805 ms) and formats in 827-1,116 ms (date-fns 1,354-1,451 ms)
- Chainable, immutable objects that read well for display code
- Tiny install: 682 KB unpacked, 451 files
Cons
- Timezone plugin arithmetic across DST was wrong in our run: add(1, 'day') from 7 March 2026 12:00 New York printed 2026-03-08T12:00:00-05:00 (an offset New York does not use that day), and the instant differed by an hour depending on the server's own time zone
- Lenient parsing by default: dayjs('2026-02-30') is valid and becomes 2 March, and non-ISO strings fall through to the JavaScript Date parser
- Time zone formatting was slow: 50,000 .tz() + format() calls took 3.1-3.5 s, against 0.5 s for date-fns TZDate and under 0.1 s for a reused Intl.DateTimeFormat
- Features you assume are built in (strict parsing, z tokens, relative time, UTC) need plugins; without advancedFormat, format('z') printed a literal z
- Plugins extend a shared global dayjs, and the object wrapper must be converted back with toDate() for most other libraries
Best For
Front-end code that mostly parses ISO strings from an API and formats them for display in the user's local time, and teams moving off Moment.js who want the same API with a much smaller bundle.
Two models: functions on native dates versus a chainable wrapper
date-fns never wraps your value. Every function is a plain export, addDays(date, 3) returns a new Date and leaves the argument untouched, and the result goes straight into JSON.stringify, a Prisma or Drizzle query, an Intl.DateTimeFormat or a date picker. That is also why date-fns tree-shakes well: a bundler only includes the functions you import. Day.js takes the Moment.js approach. dayjs(value) returns an object, and you chain methods on it until you call format(), toDate() or valueOf() to get something other libraries understand. The object is immutable, as we confirmed: calling .add(5, 'day') on an instance left it unchanged and returned a new one. The chained style reads nicely in display code, dayjs(iso).add(1, 'week').format('D MMM'), but it means the core is one object you either import or not. Day.js keeps that core small and pushes features into plugins registered globally with dayjs.extend(), which changes behaviour for every caller in the process. date-fns has no plugin system because it does not need one: time zone support arrives as an `in` option and a TZDate class, and anything else is another function. Tokens differ too. date-fns uses Unicode tokens (yyyy-MM-dd), Day.js uses Moment tokens (YYYY-MM-DD). date-fns guards the boundary: format(date, 'YYYY-MM-DD') and parse(str, 'DD/MM/YYYY', ref) threw a RangeError in our run with a message pointing at its token documentation, which catches the most common copy-paste bug from Moment-era code.
What we measured: bundle size, import time and speed
We bundled small entry points with esbuild 0.25.12 (minified, ESM, browser target) and measured gzip -9. format + addDays: date-fns 20,001 B minified / 5,789 B gzipped, Day.js 7,781 / 3,389 B. A heavier set (ISO parse, validity check, add days and months, calendar-day difference, start of week, relative time): date-fns 25,062 / 7,527 B, Day.js with relativeTime 9,355 / 4,029 B. Time zone formatting: date-fns with @date-fns/tz 24,964 / 7,303 B, Day.js with utc and timezone 12,339 / 4,999 B. date-fns's floor is set by format(), which pulls in the en-US locale and its formatters, so Day.js wins every small build; the gap narrows as you use more functions. In Node 22.23.5, import('dayjs') took 5-7 ms. import('date-fns') from the root ESM entry took 501-584 ms because Node loads about 250 separate modules; require('date-fns') took 47-58 ms and importing only date-fns/format and date-fns/addDays took 64-79 ms. That matters for serverless cold starts. For throughput we ran 500,000 operations on one core, three times. Parsing ISO strings: Day.js 136-192 ms, parseISO 666-805 ms. Formatting: Day.js 827-1,116 ms, date-fns 1,354-1,451 ms. Adding three days then taking the start of the month: date-fns 104-108 ms, Day.js 673-830 ms, because each Day.js step allocates a new wrapper. Formatting 50,000 dates in Europe/Berlin: Day.js .tz() 3,119-3,503 ms, date-fns TZDate 467-557 ms, a reused Intl.DateTimeFormat 56-97 ms.
Time zones and DST: where the two disagreed
We started from 7 March 2026 12:00 in America/New_York, the day before US clocks moved forward, and added one day. date-fns with new TZDate(2026, 2, 7, 12, 0, 'America/New_York') and addDays returned 2026-03-08 12:00 -04:00 (16:00 UTC), and addHours(…, 24) returned 13:00 -04:00 (17:00 UTC), exactly the calendar-day versus elapsed-time distinction you want. The results were identical when we ran the process with TZ set to UTC, Asia/Kolkata and America/New_York. Day.js with dayjs.tz('2026-03-07 12:00', 'America/New_York').add(1, 'day') printed 2026-03-08T12:00:00-05:00, an offset New York does not use on that date, and the instant underneath depended on the host: 17:00 UTC (13:00 local) on UTC and Kolkata servers, 16:00 UTC on a New York machine. add(24, 'hour') printed 12:00 -05:00 on a UTC host and 13:00 -05:00 on a New York host. startOf('day').add(2, 'day') printed 2026-03-09T00:00:00-05:00 on every host, which is 01:00 local, so a 'midnight' bucket was an hour off. Calling .tz('America/New_York') again on the result printed the correct local time. The autumn change showed the same pattern. Both libraries resolved the non-existent local time 02:30 on 8 March to 03:30 -04:00. Day.js 1.11.22 fixed a related .tz() offset bug in August, but on 1.11.23 add() across DST still behaved as above. The practical rule: if you keep Day.js for time zones, re-apply .tz() after every manipulation and test DST dates; if zone math is central to your product, date-fns is the safer default.
Parsing and validation: strict versus forgiving
Bad input is where these libraries quietly differ. dayjs('2026-02-30') returned a valid object for 2 March 2026, the same as new Date('2026-02-30') in V8. parseISO('2026-02-30') returned Invalid Date, so isValid() catches it. A US-style string, '11/28/2026', parsed in Day.js because the core hands anything that is not ISO 8601 to the JavaScript Date parser; the Day.js docs themselves say to use String + Format for consistent results with non-ISO strings. parseISO rejected it. With an explicit format, Day.js's customParseFormat plugin in its default mode turned '31/02/2026' into 3 March; only the strict third argument, dayjs(str, 'DD/MM/YYYY', true), marked it invalid. date-fns parse('31/02/2026', 'dd/MM/yyyy', new Date()) returned Invalid Date with no extra flag. If you accept dates from users or CSV files, that difference decides whether bad rows fail loudly or turn into plausible but wrong dates. Both libraries agreed on month-end arithmetic: 31 January plus one month is 28 February 2026, and the month difference between those two dates is 1. Formatting tokens are the other trap. Day.js uses Moment-style tokens, but z and zzz (time zone names) need the advancedFormat plugin on top of timezone; without it, format('z') printed a literal z in our build. date-fns throws on the Moment tokens YYYY and DD unless you opt in, which feels strict but avoids a real trap: in Unicode tokens YYYY is the week-numbering year and DD the day of the year, so a format string copied from Moment code would otherwise print the wrong values.
Limits, migration and when not to use each
Do not choose date-fns if your page only formats a few timestamps and every kilobyte counts: Day.js was 2.4-2.6 kB gzipped smaller in every build we made. Do not import the root date-fns entry as ESM in latency-sensitive Node code such as serverless handlers; use subpath imports or bundle the function. Expect a learning curve on Unicode tokens, and know that 4.4.0 is still a 10.9 MB, 5,136-file install, which slows CI caches and container builds a little. Do not choose Day.js for scheduling, billing, reporting by local day, or anything else where arithmetic in a named time zone must be exact, unless you test across DST and re-apply .tz() after changes. Avoid relying on its default parser for user input; register customParseFormat and use strict mode. Remember plugins are global: one module calling dayjs.extend() changes behaviour everywhere. Migration costs differ. Moving from Moment.js to Day.js is mostly renaming the import and adding plugins for the features you used. Moving from Moment or Day.js to date-fns means rewriting call sites (dayjs(d).add(1, 'day') becomes addDays(d, 1)) and every format string (YYYY to yyyy, DD to dd); the RangeError helps you find them. Both are free and MIT-licensed with zero dependencies. Both are actively patched but conservative: Day.js has stayed on 1.11.x, and date-fns has a 5.0 alpha whose only change so far is removing the CDN scripts. date-fns 4.2.0 added references to the Temporal API in its docs, a sign that native Temporal is the long-term direction for both.
Verdict
Pick date-fns for new TypeScript projects and for any server-side or scheduling code where dates have to be right in a specific time zone. In our runs it was the only one of the two whose time zone arithmetic was correct across a DST change and identical whatever time zone the server runs in, it rejected impossible dates instead of silently rolling them forward, it threw on Moment-style tokens rather than formatting garbage, and it was about seven times faster at arithmetic. Import functions from subpaths (or rely on your bundler) so you do not pay the 0.5 s root ESM import in Node. Pick Day.js when the job is displaying API timestamps in the browser in the user's local time, when bundle size is the main constraint (it was 2.4-2.6 kB gzipped smaller in every build we made), or when you are migrating a Moment.js codebase and want the same API. If you use Day.js with time zones, re-apply .tz(zone) after add() or startOf() and test around DST dates, or do the zone math with Intl or date-fns. For new code that can wait, keep an eye on the Temporal API, which date-fns itself now references in its docs.