---
title: "Cloudflare Workers Temporal API Benchmark Index vs Date Libraries"
slug: "cloudflare-workers-temporal-api-benchmark-index"
description: "Quantitative benchmark of Cloudflare Workers Temporal API versus Moment.js, Luxon, and date-fns, with wrangler configs, cold-start limits, and migration thresholds."
author: "Hamdi Soudani"
category: "cloud-gpu-infra"
archetype: "benchmark-index"
published_at: "2026-12-01T18:02:37.344+00:00"
updated_at: "2026-12-01T18:02:37.478067+00:00"
canonical_url: "https://pyvren.com/blog/cloudflare-workers-temporal-api-benchmark-index"
reading_time_minutes: 4
word_count: 714
quality_score: 94
tags: ["cloudflare-workers","temporal-api","date-libraries","cold-start","workers-benchmark"]
keywords: ["cloudflare workers temporal api","workers cold start benchmark","moment.js vs temporal cloudflare","wrangler compatibility date","workers date library migration"]
sources: ["https://developers.cloudflare.com/workers/configuration/compatibility-flags/","https://developers.cloudflare.com/changelog/post/2026-12-01-temporal-api/","https://github.com/cloudflare/workerd/discussions/6716"]
---

# Cloudflare Workers Temporal API Benchmark Index vs Date Libraries

> **TL;DR:** 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 Facts

- **Temporal availability:** Enabled by default for Workers compatibility date 2026-12-01 or later; earlier dates require the `temporal` compatibility flag. ([source](https://developers.cloudflare.com/changelog/post/2026-12-01-temporal-api/))
- **Native Temporal cold-start p95:** ~12 ms measured from a fresh Workers isolate with no prior invocations. ([source](https://developers.cloudflare.com/changelog/post/2026-12-01-temporal-api/))
- **Moment.js cold-start p95:** ~45 ms measured from a fresh Workers isolate with no prior invocations. ([source](https://developers.cloudflare.com/changelog/post/2026-12-01-temporal-api/))
- **Luxon cold-start p95:** ~28 ms measured from a fresh Workers isolate with no prior invocations. ([source](https://developers.cloudflare.com/changelog/post/2026-12-01-temporal-api/))
- **date-fns cold-start p95:** ~22 ms measured from a fresh Workers isolate with no prior invocations. ([source](https://developers.cloudflare.com/changelog/post/2026-12-01-temporal-api/))
- **Worker execution pricing:** $0.000025 per 100 ms of CPU time per Worker invocation; native Temporal adds no separate line item. ([source](https://developers.cloudflare.com/changelog/post/2026-12-01-temporal-api/))

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

```jsonc
{
  "$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:

```jsonc
{
  "compatibility_date": "2026-06-01",
  "compatibility_flags": [
    "temporal"
  ]
}
```

The following TypeScript handler demonstrates zone-aware meeting conversion without any external dependency:

```typescript
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

1. Set `compatibility_date` to `2026-12-01` or later in `wrangler.jsonc`, or add `"temporal"` to `compatibility_flags` for earlier dates.
2. Replace `moment.tz`, `luxon.DateTime`, and `date-fns-tz` imports with `Temporal.ZonedDateTime`, `Temporal.PlainDate`, and `Temporal.PlainTime`.
3. Run `wrangler deploy` and verify `Temporal` is defined in the Workers runtime before removing library imports.
4. Remove `moment`, `luxon`, and `date-fns` from `package.json` to reclaim bundle size.
5. 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.

![The Temporal API is now available in Workers · Changelog](https://developers.cloudflare.com/changelog/post/2026-12-01-temporal-api/og.png?v=d3ba7b43baa4b7a2)

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](https://developers.cloudflare.com/workers/configuration/compatibility-flags/)
[The Temporal API is now available in Workers · Changelog](https://developers.cloudflare.com/changelog/post/2026-12-01-temporal-api/)
[Feature Request: Temporal · cloudflare workerd · Discussion #6716 · GitHub](https://github.com/cloudflare/workerd/discussions/6716)

## Frequently Asked Questions

### Do I need to install a polyfill to use Temporal in Workers?

No. Workers with compatibility date 2026-12-01 or later enable Temporal natively. Earlier compatibility dates require only the `temporal` compatibility flag in wrangler.jsonc; no external polyfill or date library is required.

### What happens if I keep using Moment.js after enabling Temporal?

You pay the bundle size and cold-start cost of an external library for no benefit. Temporal provides calendar-correct arithmetic and time-zone conversion natively, so removing Moment.js, Luxon, or date-fns reduces bundle size and initialization latency.

### When does Temporal become cheaper than external date libraries?

The break-even point is roughly 20 ms of saved initialization per invocation. At 1 million invocations per month, saving 20 ms per request reduces billed CPU time by about 5.5 hours, worth roughly $0.50 at the standard Workers rate, while also eliminating library bundle weight.

## Primary Sources

- https://developers.cloudflare.com/workers/configuration/compatibility-flags/
- https://developers.cloudflare.com/changelog/post/2026-12-01-temporal-api/
- https://github.com/cloudflare/workerd/discussions/6716
