Urgent.News

What's breaking now, across thousands of outlets.

Tech

Node.js 26's default Temporal API fixes a one-hour DST drift that Date still has

tomorrow = new Date(now.getTime() + 24 * 60 * 60 * 1000) is a line that turns up in a lot of scheduling and billing code. It looks harmless, and for most of the year it is. Twice a year, in any timezone that observes daylight saving, it's wrong by an hour. Node.js 26, released in May, turns on the Temporal API without a flag. The release notes describe it as a "modern date/time API for JavaScript…

Node.js 26's default Temporal API addresses the one-hour daylight saving time (DST) drift that the Date object still experiences. This line, "tomorrow = new Date(now.getTime() + 24 * 60 * 60 * 1000)", is found in many scheduling and billing code. In most years, it works fine, but twice a year in any timezone observing DST, it's off by an hour.

Node.js 26 releases the Temporal API without any flags, described in release notes as a "modern date/time API for JavaScript that provides a more robust and feature-rich alternative to the legacy Date object". The experiment, conducted using Node.js 26 and 24, showed the drift in the Date version compared to the Temporal API. The Date version lands an hour later due to walking straight through the skipped hour when adding 24 hours of UTC time.

In contrast, Temporal keeps the wall-clock time fixed and lets the UTC offset move, providing a more accurate result. While Temporal is designed for correctness and offers strict error handling, providing a different kind of wrong compared to Date, it does not throw an error by default for out-of-range values. These changes were present in Node 24 LTS, but require a flag for usage.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Homelab security on 512 MB: warden scores my logs and asks before it bans anything

I wanted one place that tells me what is going on in my homelab: who is poking at it from outside, which boxes have known-exploited CVEs, what needs patching, and whether anything new turned up on the…

  • "Warden" monitors homelab security on minimal resources
  • Combines scanners and adds logic without agents
  • Uses Discord for user approval before taking action

More from Saturday 10 October →