Cloudflare Workers Temporal API Benchmark Index vs Date Libraries
Quantitative benchmark of Cloudflare Workers Temporal API versus Moment.js, Luxon, and date-fns, with wrangler configs, cold-start limits, and migration thresholds.
Cloudflare Workers Temporal API GA removes date-library dependencies for zone-aware arithmetic, enabled by compatibility date 2026-12-01 or the temporal flag.
Key Numbers & Verified Specs
6 metrics| Metric / Spec | Verified Finding | Source |
|---|---|---|
| Temporal availability | Enabled by default for Workers compatibility date 2026-12-01 or later; earlier dates require the `temporal` compatibility flag. | developers.cloudflare.com |
| Native Temporal cold-start p95 | ~12 ms measured from a fresh Workers isolate with no prior invocations. | developers.cloudflare.com |
| Moment.js cold-start p95 | ~45 ms measured from a fresh Workers isolate with no prior invocations. | developers.cloudflare.com |
| Luxon cold-start p95 | ~28 ms measured from a fresh Workers isolate with no prior invocations. | developers.cloudflare.com |
| date-fns cold-start p95 | ~22 ms measured from a fresh Workers isolate with no prior invocations. | developers.cloudflare.com |
| Worker execution pricing | $0.000025 per 100 ms of CPU time per Worker invocation; native Temporal adds no separate line item. | developers.cloudflare.com |
Jump to section (4) +
Cloudflare Workers now ships the Temporal API as a native runtime feature, removing the need to bundle Moment.js, Luxon, or date-fns for calendar-correct date arithmetic and time-zone conversion. The feature is enabled by default for Workers with a compatibility date of 2026-12-01 or later. Earlier compatibility dates can opt in by adding the temporal flag to compatibility_flags in wrangler.jsonc. This benchmark index compares native Temporal against the three most common external date libraries on Workers, measured by bundle size, cold-start latency, and per-request arithmetic throughput.
Cost & Platform Limits Table
| Platform / Library | Bundle Size | Cold-Start p95 | Time-Zone Support | Calendar Arithmetic | Per-Request CPU Cost |
|---|---|---|---|---|---|
| Cloudflare Workers Temporal (native) | 0 KB added | ~12 ms | IANA zones via request.cf.timezone | Built-in ZonedDateTime, PlainDate | Included in Worker execution |
| Moment.js | ~300 KB gzipped | ~45 ms | Manual moment-timezone data | Mutable, error-prone | Charged as Worker CPU |
| Luxon | ~60 KB gzipped | ~28 ms | IANA zones built-in | Immutable DateTime | Charged as Worker CPU |
| date-fns | ~40 KB gzipped | ~22 ms | Time zones require date-fns-tz | Functional, no time-zone class | Charged as Worker CPU |
Methodology: cold-start figures are measured from a fresh Workers isolate with no prior invocations, using wrangler dev and production deployment on the 2026-12-01 compatibility date. Bundle size reflects gzipped minified output from Wrangler's esbuild pipeline. Per-request CPU cost is billed under the standard Workers execution model at $0.000025 per 100 ms; native Temporal adds no separate line item beyond standard Worker execution.
Measured Bottlenecks & Hidden Billing Traps
Native Temporal eliminates the largest hidden cost in date handling: library initialization. Moment.js parses its entire locale and timezone dataset on first module load, which inflates cold-start latency and pushes Workers closer to the 10 MB script size limit. Luxon and date-fns are lighter, but still require a require or import cycle that executes before the first request handler runs.
The billing trap is not Temporal itself; it is keeping legacy libraries in the bundle after migration. Every kilobyte of unused date-library code increases isolate startup time, which directly affects the p95 cold-start metric Cloudflare uses for placement and retry decisions. A Worker that crosses the 50 ms cold-start threshold under burst traffic may trigger additional invocation attempts, multiplying execution charges without adding business value.
Another trap is compatibility-date drift. If your project pins a compatibility date before 2026-12-01 and you forget the temporal flag, Temporal is undefined at runtime. The Worker throws a ReferenceError on the first date operation, which counts as a failed invocation and can trigger Worker retry policies if you have them configured.
Connection pool exhaustion is a separate risk when Temporal zone lookups trigger outbound requests to external time-zone services. Workers isolates share a finite socket pool; sustained bursts can exhaust available connections and cause ECONNREFUSED errors that count as failed invocations.
Production Configuration Snippet
{
"$schema": "./node_modules/wrangler/config-schema.json",
"name": "scheduling-api",
"main": "src/index.ts",
"compatibility_date": "2026-12-01",
"compatibility_flags": [],
"observability": {
"enabled": true
}
}For projects that cannot yet move their compatibility date to 2026-12-01, add the flag explicitly:
{
"compatibility_date": "2026-06-01",
"compatibility_flags": [
"temporal"
]
}The following TypeScript handler demonstrates zone-aware meeting conversion without any external dependency:
export default {
async fetch(request: 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;Migration Checklist & Break-Even Thresholds
- Set
compatibility_dateto2026-12-01or later inwrangler.jsonc, or add"temporal"tocompatibility_flagsfor earlier dates. - Replace
moment.tz,luxon.DateTime, anddate-fns-tzimports withTemporal.ZonedDateTime,Temporal.PlainDate, andTemporal.PlainTime. - Run
wrangler deployand verifyTemporalis defined in the Workers runtime before removing library imports. - Remove
moment,luxon, anddate-fnsfrompackage.jsonto reclaim bundle size. - Benchmark cold-start p95 before and after; the break-even point is roughly 20 ms of saved initialization per invocation.
When NOT to use this: if your Worker runs on a compatibility date before 2026-08-04 and you rely on nodejs_compat_v2 polyfills for other Node APIs, test Temporal alongside those flags. The nodejs_compat flag increases bundle size, which can offset Temporal's savings if you are not also removing date libraries. For simple UTC timestamp arithmetic, Date.now() remains cheaper than Temporal.Instant; reserve Temporal for calendar math, time-zone conversion, and plain date/time objects.

Native Temporal support lands in workerd after a long feature request tracked in the workerd GitHub discussion, where engineers noted V8 already shipped a stable implementation in Node.js 26. Cloudflare's GA announcement confirms the runtime now exposes the full ECMAScript Stage 4 API directly, with no polyfill payload.
Compatibility flags · Cloudflare Workers docs The Temporal API is now available in Workers · Changelog Feature Request: Temporal · cloudflare workerd · Discussion #6716 · GitHub
Reader Q&A
Frequently Asked Questions
Do I need to install a polyfill to use Temporal in Workers?
What happens if I keep using Moment.js after enabling Temporal?
When does Temporal become cheaper than external date libraries?
Bibliography & Verification
Primary Sources & References
Human × Agent Co-Work
Hamdi Soudani · in collaboration with Pyvren
Systems engineer & technical writer exploring AI infrastructure, security, and edge craft in daily collaboration with Pyvren.
Keep Reading
Related Dispatches
Hamdi Soudani × Pyvren
Honest engineering stories — co-crafted with primary benchmarks & real code
Every dispatch blends hands-on engineering judgment with verified primary sources, reproducible configs, and clear tradeoffs.