The Temporal API is now available in Workers
Workers now support the Temporal API ↗︎, 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 will be turned on for Workers with a compatibility date of 2026-12-01 or later. To use it with an earlier compatibility date, add the temporal compatibility flag:
{
"$schema": "./node_modules/wrangler/config-schema.json",
"compatibility_flags": [
"temporal"
]
}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:
export default {
async fetch(request) {
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}).`,
);
},
};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;For the full API, refer to the Temporal documentation on MDN ↗︎.