Skip to content

Cloudflare Workers can now use the Temporal API natively

Workers gets built-in support for time zone conversion and calendar-correct date math, no more bundling Moment.js, Luxon or date-fns just to handle dates.

Source: Cloudflare

Cloudflare Workers now support the Temporal API, the modern JavaScript standard for dates and times, as of 1 December. You can convert between time zones and do calendar-correct date arithmetic without bundling a library such as Moment.js, Luxon or date-fns.

It is on by default for any Worker with a compatibility date of 2026-12-01 or later. For an earlier compatibility date, add the temporal compatibility flag instead:

"compatibility_flags": ["temporal"]
const meeting = Temporal.ZonedDateTime.from(
  "2026-12-15T09:30[America/New_York]",
);
const local = meeting.withTimeZone(timeZone);

Cloudflare’s own example reads the visitor’s time zone off request.cf?.timezone and converts a fixed meeting time into it directly, no library involved.

Why it matters: Date has never handled time zones or calendar arithmetic properly, which is why almost every non-trivial Worker pulls in a date library for it. Temporal replaces that dependency with a native API, which matters more at the edge than elsewhere: every package you don’t bundle is less that has to ship with your Worker and less that counts against its size limit.

Share

Related reading

More from The Wire

All briefs

node-tar patches a Windows RCE bug triggered by npm install

A newline-injection flaw in node-tar let a crafted archive forge its own file paths and run code during npm install on Windows. The fix landed in a string of releases up to 8.1.0 on 2 December.

via GitHub Security Advisories (isaacs/node-tar)