Cloudflare Workers Adds Temporal API: Native Time Zones & Calendar Math
Cloudflare Workers now supports the standard Temporal API as of December 1, 2026. Learn how to enable it via compatibility_date or the temporal flag.

Q. Can Cloudflare Workers handle time zone conversions and calendar math without Moment.js or date-fns? Yes. On December 1, 2026, Cloudflare officially added support for the modern JavaScript
TemporalAPI in Workers. By settingcompatibility_dateto2026-12-01or later—or adding the"temporal"compatibility flag—you can convert time zones, handle daylight saving time, and run calendar-correct arithmetic without bundling external date libraries.
⚠️ Accuracy guardrail: This article is based on the Cloudflare Workers Changelog and Compatibility Flags documentation published on December 1, 2026. Future compatibility date policies and runtime details may evolve, and exact bundle-size savings or runtime performance benchmarks compared to third-party libraries were not disclosed in the official announcement.
30-second summary
- Official support: Starting December 1, 2026, Cloudflare Workers natively supports the
TemporalAPI. - How to enable: Enabled by default for
compatibility_date2026-12-01or later; earlier dates can opt in via"temporal"incompatibility_flags. - Immutable & calendar-aware: Every
Temporalobject is immutable, handling daylight saving time (DST), month-end boundaries, and leap years by standard. - Edge-ready conversion: Combining
request.cf?.timezonewithTemporal.ZonedDateTimelets you format visitor-local times with zero external dependencies.

Why Temporal replaces Date and external libraries
JavaScript's legacy Date object is mutable and offers limited time zone handling, which pushed many teams to bundle Moment.js, Luxon, or date-fns. On edge runtimes like Cloudflare Workers, carrying third-party date packages solely for time zone conversion and DST rules adds unnecessary bundle weight and maintenance overhead.
The Temporal API is the modern JavaScript standard built to solve those pain points. All Temporal instances are immutable—operations return new objects instead of mutating existing values—and plain calendar dates or wall-clock times (PlainDate, PlainTime) are cleanly separated from time-zone-aware instants (ZonedDateTime).

| Aspect | Legacy Date + External Libraries |
Built-in Workers Temporal API |
|---|---|---|
| Mutability | Mutable (setMonth() mutates in place) |
Strictly immutable (returns new objects) |
| Time zones & DST | Requires bundling external packages | Native runtime support (withTimeZone()) |
| Calendar arithmetic | Prone to month-end and leap-year edge cases | Built-in calendar math (add({ months: 1 })) |
| Bundle footprint | Adds dependency size | 0 KB (provided by the runtime) |
How to enable Temporal in your Worker
For new projects or Workers targeting recent compatibility dates, setting compatibility_date to 2026-12-01 or later turns Temporal on automatically. If your existing Worker uses an earlier compatibility date, add the "temporal" flag in wrangler.jsonc or wrangler.toml to opt in without changing other behaviors.
// wrangler.jsonc
{
"$schema": "./node_modules/wrangler/config-schema.json",
"compatibility_flags": [
"temporal"
]
}
# wrangler.toml
compatibility_flags = ["temporal"]
If you use a compatibility date of 2026-12-01 or later and need to opt out, you can specify no_temporal. While reviewing your compatibility flags, it is also worth checking recent security additions like Cloudflare Workers fetch() redirect: "error".
Practical usage: request.cf.timezone and calendar math
Cloudflare Workers exposes the visitor's detected time zone via request.cf?.timezone. By parsing a timestamp with Temporal.ZonedDateTime.from() and calling .withTimeZone(timeZone), your Worker can respond in the visitor's local time—including automatic DST adjustments.
export default {
async fetch(request): Promise<Response> {
const timeZone = request.cf?.timezone ?? "UTC";
const meeting = Temporal.ZonedDateTime.from(
"2026-12-15T09:30[America/New_York]",
);
const local = meeting.withTimeZone(timeZone);
return new Response(
`The meeting starts at ${local.toPlainTime()} on ${local.toPlainDate()} (${timeZone}).`,
);
},
} satisfies ExportedHandler;
Calendar arithmetic works just as cleanly: calling meeting.add({ months: 1 }).toPlainDate().toString() produces "2027-01-15" following calendar rules. For current timestamps, Temporal.Now returns the same clock time as Date.now().

Toris's take
When to enable temporal right away
- If your Workers API handles booking schedules, subscription billing cycles, or localized notifications, enabling
"temporal"lets you replace heavy date-formatting dependencies cleanly. - Solo founders and lean teams sensitive to bundle size can simplify dependencies by dropping
date-fnsorLuxonfrom edge endpoints.
When to keep a boundary layer
- If downstream SDKs or existing database helpers strictly expect legacy
Dateobjects, convert at the boundary rather than rewriting every internal interface at once. - When evaluating edge runtime features alongside storage or agent tooling, compare runtime constraints just as you would with Vercel Drives CLI and standalone SDK.
Sources
Advertisement