From 48d276a0d544d9b5be1f8f59d18cb384f0bf519c Mon Sep 17 00:00:00 2001 From: Nicholas Paun Date: Wed, 28 Oct 2026 23:46:11 +0000 Subject: [PATCH 1/2] [Workers] Document the temporal compatibility flag Add the compatibility flag page for `temporal`, which makes the Temporal date and time API available in Workers, and a changelog entry announcing it. Both are dated 2026-12-01, the flag's default-on date. Co-Authored-By: Claude Opus 5.5 --- .../workers/2026-12-01-temporal-api.mdx | 46 +++++++++++++++++++ src/content/compatibility-flags/temporal.md | 37 +++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 src/content/changelog/workers/2026-12-01-temporal-api.mdx create mode 100644 src/content/compatibility-flags/temporal.md diff --git a/src/content/changelog/workers/2026-12-01-temporal-api.mdx b/src/content/changelog/workers/2026-12-01-temporal-api.mdx new file mode 100644 index 00000000000..27198fe88cf --- /dev/null +++ b/src/content/changelog/workers/2026-12-01-temporal-api.mdx @@ -0,0 +1,46 @@ +--- +title: The Temporal API is now available in Workers +description: Workers now support Temporal, the modern JavaScript API for dates, times, and time zones. +products: + - workers +date: 2026-12-01 +--- + +import { TypeScriptExample, WranglerConfig } from "~/components"; + +Workers now support the [Temporal API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal), the modern JavaScript standard for dates and times. You can convert between time zones, do calendar-correct date arithmetic, and work with plain dates and times, without bundling a date library such as Moment.js, Luxon, or date-fns. + +Temporal is turned on for Workers with a [compatibility date](/workers/configuration/compatibility-dates/) of `2026-12-01` or later. To use it with an earlier compatibility date, add the [`temporal`](/workers/configuration/compatibility-flags/#enable-the-temporal-api) compatibility flag: + + + +```toml +compatibility_flags = ["temporal"] +``` + + + +This example shows the time a meeting starts in the visitor's time zone, using the time zone Cloudflare detects for the request: + + + +```ts +export default { + async fetch(request): Promise { + 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; +``` + + + +For the full API, refer to the [Temporal documentation on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal). diff --git a/src/content/compatibility-flags/temporal.md b/src/content/compatibility-flags/temporal.md new file mode 100644 index 00000000000..9c11c93cfec --- /dev/null +++ b/src/content/compatibility-flags/temporal.md @@ -0,0 +1,37 @@ +--- +_build: + publishResources: false + render: never + list: never + +name: "Enable the Temporal API" +sort_date: "2026-12-01" +enable_date: "2026-12-01" +enable_flag: "temporal" +disable_flag: "no_temporal" +--- + +Makes the [Temporal API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal) available in your Worker. Temporal is the modern JavaScript standard for working with dates and times, and replaces many of the uses of `Date` and of date libraries such as Moment.js, Luxon, or date-fns. + +With Temporal you can: + +- Convert between time zones, with daylight saving time handled for you. +- Work with plain dates and times, such as a birthday or an opening hour, without a time zone getting in the way. +- Add and subtract durations like "1 month and 3 days" and get calendar-correct results. +- Compare and sort dates and times, and format them for any locale. + +Temporal objects are immutable, so a value never changes after you create it. + +```js +const meeting = Temporal.ZonedDateTime.from( + "2026-12-15T09:30[America/New_York]", +); + +meeting.withTimeZone("Europe/London").toString(); +// "2026-12-15T14:30:00+00:00[Europe/London]" + +meeting.add({ months: 1 }).toPlainDate().toString(); +// "2027-01-15" +``` + +`Temporal.Now` returns the same time as `Date.now()`. For more information, refer to [Performance and timers](/workers/runtime-apis/performance/). From d6dd1d261f8fdbefe2aeb9823694ebb816f86998 Mon Sep 17 00:00:00 2001 From: Nicholas Paun Date: Thu, 29 Oct 2026 00:53:01 +0000 Subject: [PATCH 2/2] Use future tense for the Temporal default-on date Co-Authored-By: Claude Opus 5.5 --- src/content/changelog/workers/2026-12-01-temporal-api.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/changelog/workers/2026-12-01-temporal-api.mdx b/src/content/changelog/workers/2026-12-01-temporal-api.mdx index 27198fe88cf..ff4f59264d2 100644 --- a/src/content/changelog/workers/2026-12-01-temporal-api.mdx +++ b/src/content/changelog/workers/2026-12-01-temporal-api.mdx @@ -10,7 +10,7 @@ import { TypeScriptExample, WranglerConfig } from "~/components"; Workers now support the [Temporal API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal), the modern JavaScript standard for dates and times. You can convert between time zones, do calendar-correct date arithmetic, and work with plain dates and times, without bundling a date library such as Moment.js, Luxon, or date-fns. -Temporal is turned on for Workers with a [compatibility date](/workers/configuration/compatibility-dates/) of `2026-12-01` or later. To use it with an earlier compatibility date, add the [`temporal`](/workers/configuration/compatibility-flags/#enable-the-temporal-api) compatibility flag: +Temporal will be turned on for Workers with a [compatibility date](/workers/configuration/compatibility-dates/) of `2026-12-01` or later. To use it with an earlier compatibility date, add the [`temporal`](/workers/configuration/compatibility-flags/#enable-the-temporal-api) compatibility flag: