Temporal vs date-fns 4: Node 26 LTS Got Every DST Edge Right, date-fns Didn't
The 60-second version of this test. Subscribe on YouTube
Node 26 became an LTS release on October 28 (26.13.0, codename Lithium), and since 26.0.0 it ships the Temporal API enabled by default. No flag, no polyfill. Yesterday’s 26.14.0 is the release line most teams will move their servers to next.
That puts a real question on the table for every Node backend that schedules things: do I still need date-fns for time zones, or can I delete it and use the platform? date-fns 4 isn’t the old “everything is in the server’s local time” library anymore. With @date-fns/tz and its TZDate, it does time zone math in any IANA zone.
So I wrote the same small scheduling module twice and threw the nastiest wall times I could find at both: the hours around every daylight saving change in 20 time zones, from 2025 to 2027. Then I ran the whole thing again under 20 different server time zones, because that’s the part most tests forget.
The Setup
- Machine: a 4 vCPU cloud container (Intel Xeon @ 2.10 GHz), Linux.
- Runtime: Node 26.14.0 (V8 14.6, ICU 78.3, tz database 2026e), running the
.tsfiles directly with Node’s built-in type stripping. - Side A:
[email protected]+@date-fns/[email protected](both the latest on npm today). - Side B: the global
Temporalin Node 26.14.0, no dependency. - Bundle sizes:
[email protected] --bundle --minify --format=esm --platform=browser, thengzip -9. For browsers without Temporal,[email protected].
The Same Task on Both Sides
The module answers the questions a booking or billing backend asks every day: what instant is “09:00 in Toronto”, what time is that in Paris, what are the next weekly occurrences, how many hours are between two local times, what’s one month after January 31.
Temporal, 31 lines in total. Here are the four functions that matter:
// temporal-impl.ts: Node 26.14, no dependency
export function resolveLocal(localIso: string, zone: string): string {
return Temporal.PlainDateTime.from(localIso).toZonedDateTime(zone).toInstant().toString();
}
export function wallTimeIn(localIso: string, fromZone: string, toZone: string): string {
return Temporal.PlainDateTime.from(localIso).toZonedDateTime(fromZone)
.withTimeZone(toZone).toPlainDateTime().toString();
}
export function weekly(startLocal: string, zone: string, count: number): string[] {
const first = Temporal.PlainDateTime.from(startLocal).toZonedDateTime(zone);
return Array.from({ length: count }, (_, i) =>
first.add({ weeks: i }).toInstant().toString());
}
export function hoursBetween(aLocal: string, bLocal: string, zone: string): number {
const a = Temporal.PlainDateTime.from(aLocal).toZonedDateTime(zone);
const b = Temporal.PlainDateTime.from(bLocal).toZonedDateTime(zone);
return a.until(b, { largestUnit: 'hours' }).hours;
}
date-fns, 37 lines. TZDate takes the wall-clock fields plus a zone, and every date-fns function keeps working in that zone:
// datefns-impl.ts: date-fns 4.4 + @date-fns/tz 1.5
import { addWeeks, differenceInHours, format } from 'date-fns';
import { TZDate } from '@date-fns/tz';
const iso = "yyyy-MM-dd'T'HH:mm:ss";
function local(localIso: string, zone: string): TZDate {
const [d, t] = localIso.split('T');
const [y, m, day] = d.split('-').map(Number);
const [hh, mm] = t.split(':').map(Number);
return new TZDate(y, m - 1, day, hh, mm, zone);
}
export function resolveLocal(localIso: string, zone: string): string {
return new Date(local(localIso, zone).getTime()).toISOString().replace('.000Z', 'Z');
}
export function wallTimeIn(localIso: string, fromZone: string, toZone: string): string {
return format(local(localIso, fromZone).withTimeZone(toZone), iso);
}
export function weekly(startLocal: string, zone: string, count: number): string[] {
const first = local(startLocal, zone);
return Array.from({ length: count }, (_, i) =>
new Date(addWeeks(first, i).getTime()).toISOString().replace('.000Z', 'Z'));
}
export function hoursBetween(aLocal: string, bLocal: string, zone: string): number {
return differenceInHours(local(bLocal, zone), local(aLocal, zone));
}
The rest (addOneDay, addMonths, addYears, localDateOf) follows the same pattern on both sides. Both versions give identical answers on the easy cases: a weekly 09:00 Toronto meeting moves from 13:00Z to 14:00Z after November 1, March 7 12:00 to March 8 12:00 is 23 hours, January 31 plus one month is February 28, and February 29, 2028 plus one year is February 28, 2029.
Round 1: 2,075 Wall Times Around DST Changes
The test set, generated with Temporal’s own getTimeZoneTransition():
- 20 zones: Toronto, Los Angeles, São Paulo, Havana (changes at midnight), Santiago, St. John’s (−3:30), Paris, London, Dublin (negative DST in the tz database), Casablanca, Tehran, Kolkata, Kathmandu (+5:45), Sydney, Lord Howe (30-minute DST), Chatham (+12:45), Auckland, Apia, Gaza and UTC.
- 83 offset changes between January 2025 and the end of 2027.
- 25 local times per change, every 15 minutes from 3 hours before to 3 hours after. That’s 2,075 wall times: 1,755 that exist exactly once, 162 that happen twice (the repeated hour in autumn) and 158 that don’t exist (the skipped hour in spring).
For each wall time I asked both libraries “which instant is this?” (resolveLocal). For the 1,755 unambiguous ones there’s only one right answer, and I didn’t take Temporal’s word for it: I formatted each library’s instant back into the target zone with Intl.DateTimeFormat. If that doesn’t give the original wall time back, the answer is wrong.
Then I ran the full test 20 times, once per server time zone (TZ=... node classify.ts), using the same 20 zones.
Server TZ | date-fns: wrong instants (of 1,755) | Temporal: wrong instants |
|---|---|---|
| UTC, Los Angeles, São Paulo, London, Dublin, Tehran, Kolkata, Kathmandu, Apia, Gaza | 0 | 0 |
| Casablanca | 9 | 0 |
| Havana | 6 | 0 |
| Toronto | 12 | 0 |
| St. John’s | 18 | 0 |
| Paris | 24 | 0 |
| Sydney | 33 | 0 |
| Lord Howe | 33 | 0 |
| Auckland | 39 | 0 |
| Chatham | 66 | 0 |
| Santiago | 107 (6.1%) | 0 |
Temporal got 0 wrong in all 20 runs. date-fns was perfect when the server ran in UTC and 9 other zones, and wrong on up to 107 wall times in the other 10. Here’s the shortest reproduction I found, a server in Paris booking 02:00 in London on the day the UK clocks went back:
import { TZDate } from '@date-fns/tz';
// 02:00 on 26 Oct 2025 in London: the clocks went back at 02:00 BST,
// so 02:00 GMT happens exactly once. The right instant is 02:00Z.
const df = new TZDate(2025, 9, 26, 2, 0, 'Europe/London');
const tp = Temporal.PlainDateTime.from('2025-10-26T02:00')
.toZonedDateTime('Europe/London');
console.log('host TZ ', process.env.TZ);
console.log('date-fns ', new Date(+df).toISOString());
console.log('Temporal ', tp.toInstant().toString());
$ TZ=UTC node demo.ts
host TZ UTC
date-fns 2025-10-26T02:00:00.000Z
Temporal 2025-10-26T02:00:00Z
$ TZ=Europe/Paris node demo.ts
host TZ Europe/Paris
date-fns 2025-10-26T01:00:00.000Z
Temporal 2025-10-26T02:00:00Z
Same code, same library version, a different answer because the server moved. 01:00Z is 01:00 in London, an hour early.
Why the server’s zone leaks in
The @date-fns/tz README says TZDate performs “all calculations in the given time zone rather than the system time zone”. That’s half true: the result is in the given zone, but building one from wall-clock fields still goes through the system zone. The TZDate source explains it in its own comments. JavaScript’s Date can only read and write wall-clock fields in the system time zone, so new TZDate(y, m, d, h, min, zone) first builds a native Date from those fields in the system zone, then shifts it by the difference between the system offset and the target offset, with extra corrections for DST edges. When the server’s zone changes its clocks on the same night as the target zone (Paris and London, or Sydney and Auckland), those corrections can land on the wrong side of a transition. I checked this against the data: all 347 wrong answers across the 20 runs were within 36 hours of a clock change in the server’s zone. The 1.5.0 changelog (May 2026) already fixes one case of this, “when the system time zone is west of it”. My failures are in 1.5.0, the current release.
Temporal never goes through the system zone. PlainDateTime.toZonedDateTime(zone) asks the time zone database which instants match that wall time in that zone, and the server’s TZ only matters for Temporal.Now.
The repeated hour: a policy, not a bug
For the 162 wall times that happen twice, both answers are valid instants, so I didn’t count either as wrong. But consistency matters:
- Temporal picked the first occurrence 162 times out of 162, under every server zone. That’s its default
disambiguation: 'compatible', and it matches what RFC 5545 (iCalendar) says to do. If you need the other one, you write{ disambiguation: 'later' }. - date-fns picked the second occurrence anywhere from 0 times (server in Chatham) to 150 times (server in Los Angeles). With the server in UTC: 102 later, 60 earlier.
So the same 01:30 on the November 1 fall-back night can be one hour apart depending on where your container runs. On the skipped spring hour, date-fns also disagreed with Temporal’s documented “shift forward by the gap length” on 0 to 12 wall times, depending on the server zone.
Round 2: Speed
Each task runs 3 warm-up rounds, then loops for 1.5 s. Both tools ran 5 times, interleaved, with TZ=UTC (the case where both are correct). Median throughput, 4 zones × 250 wall times:
| Task | date-fns 4.4 + tz 1.5 | Temporal (Node 26.14) | Ratio |
|---|---|---|---|
Wall time → instant (resolveLocal) | 66,463 ops/s | 336,794 ops/s | 5.1x |
Convert to another zone + ISO string (wallTimeIn) | 29,975 ops/s | 229,765 ops/s | 7.7x |
52 weekly occurrences (weekly) | 1,302 series/s | 6,115 series/s | 4.7x |
Date + 1 month (addMonths) | 236,726 ops/s | 459,301 ops/s | 1.9x |
Part of the wallTimeIn gap is format(), which splits its pattern string with a regex on every call, while Temporal’s toString() is native. But that is the code you would actually write with each library. Either way, unless you do this millions of times per request, speed is not the deciding factor here. Correctness is.
Round 3: Bundle Size (the One date-fns Wins)
On a Node 26 server, Temporal weighs nothing: my module bundles to 385 bytes gzipped. In the browser, it depends on Safari. As of today, caniuse and the web-features explorer list Temporal in Chrome and Edge 144+ and Firefox 139+, but not in a stable Safari (desktop or iOS), only in Safari Technology Preview. So for the browser you still ship a polyfill:
| Browser bundle (min + gzip) | Size |
|---|---|
| date-fns 4.4 + @date-fns/tz 1.5 (tree-shaken) | 8,637 B |
| Temporal, native only | 385 B |
Temporal + [email protected] | 20,246 B |
If your front end must run in Safari today, date-fns is 2.3x smaller than Temporal plus a polyfill. (And in the browser, the “system time zone” is the user’s zone, which you don’t control either.)
Comparison Table
| date-fns 4.4 + @date-fns/tz 1.5 | Temporal (Node 26.14) | |
|---|---|---|
| Wrong instants, 1,755 unambiguous wall times | 0 to 107, depends on server TZ | 0 under every server TZ |
| Repeated hour | First or second, depends on server TZ | Always first; disambiguation option |
| Speed (wall time → instant) | 66k ops/s | 337k ops/s |
| Server dependency | 2 packages | None (Node 26+) |
| Browser bundle without native Temporal | 8.6 KB gz | 20.2 KB gz with polyfill |
| Runs on Node 22 / 24 | Yes | No (typeof Temporal is undefined on 24.22.3) |
| Lines for my module | 37 | 31 |
| Separate types for date, wall time, instant | No, everything is a Date | Yes: PlainDate, PlainDateTime, ZonedDateTime, Instant |
Where Temporal Wins
- Anything that turns a user’s wall time into an instant on the server: bookings, reminders, billing cut-offs, recurring meetings. It was right under all 20 server zones in my test, and its behavior on DST edges is written in a spec, not tuned by heuristics.
- Code where “date” and “date with a time zone” mean different things.
PlainDate.add({ months: 1 })can’t accidentally depend on a time zone, because it doesn’t have one. - Hot paths: 1.9x to 7.7x faster in my runs, with zero dependencies to update.
Where date-fns Wins
- Browsers, until Safari ships Temporal: 8.6 KB against 20.2 KB with a polyfill.
- Node 22 and 24, which are still supported and don’t have Temporal.
- A large codebase built on
Date: date-fns functions take and returnDate, so you can adopt them one call at a time, and itsformat()patterns and locales are hard to beat for display. - If you already pin your servers to
TZ=UTC: in that run, date-fns made 0 errors on unambiguous times. It still chose the second occurrence for 102 of the 162 repeated wall times, so check that this is what you want.
Decision Table
| Your situation | Pick |
|---|---|
| New Node 26 backend that schedules things in users’ zones | Temporal |
| Existing Node backend on date-fns, servers in UTC | Keep date-fns for now, migrate time zone code to Temporal first |
| Existing Node backend on date-fns, servers in a local zone | Temporal for anything that builds instants from wall times, or force TZ=UTC today |
| Front end that must support Safari | date-fns (or Temporal + polyfill if 20 KB is fine) |
| Library that must run on Node 22/24 | date-fns |
The Verdict
Temporal wins on Node 26. Not because it’s 5x faster, but because it gave the same correct answer no matter where the server ran, and date-fns + @date-fns/tz 1.5 did not: up to 107 of 1,755 unambiguous wall times landed on the wrong instant when the server’s own zone had a DST change nearby. date-fns is still the better pick in a Safari-facing bundle and on Node 22/24.
If you stay on date-fns, the cheapest fix is the boring one: run your servers with TZ=UTC and add a test that runs your date code under a second TZ. It took one environment variable to find every failure in this article.
Caveats: the zones, transitions and 15-minute grid are my choice, and the “right answer” for unambiguous times is a round-trip check with Intl.DateTimeFormat, which uses the same ICU data as Temporal in Node. I tested the TZDate constructor path, which is how you’d build a date from user input; other entry points (like parsing a full ISO string with an offset) don’t need disambiguation. One 4-core machine, 5 timed runs.
Related Articles
More tested TypeScript tooling clashes:
- Vitest 5 vs Jest 30: Jest Won My Benchmark Until I Changed One Flag — Another clash where the environment, not the code, decides the result.
- TypeScript 6 Erased My Build Step — And That Changes Everything — Why Node can run the
.tsfiles in this article directly. - pnpm 12 vs Bun 1.4: Both in Rust Now, and Each Wins a Different Install — Measured the same way: 4 vCPU, interleaved runs, median of 5.
Enjoying the content? Here are tools I personally use and recommend:
- 🌐 Hosting: Bluehost — simple hosting for a WordPress or PHP site
- 🛒 Tech Gear: My Amazon Store — keyboards, monitors, dev tools I use
Purchases through my links help keep this blog ad-free 💙
Enjoyed this post?
Every clash gets a video: two tools, one real task, a measured winner.
▶ Subscribe on YouTube 🎬 All videos