Skip to content
jshacks.dev
Fundamentals

What Is Coming in ES2027 Temporal and using Explained

ES2027 is lined up to standardize Temporal and the using declaration, and both already run in engines. See what each does and how to adopt them early.

7 min read
Summarize in AI
Flat illustration of an editor window full of code, with the JavaScript, Node.js, npm, TypeScript and Vite logos.

Every June the standards committee publishes the next edition of the language, and the two features that most developers will notice in the one after ES2026 have been in engines for a while. Temporal replaces the Date object that has caused thirty years of bugs, and the using declaration gives JavaScript the scoped resource cleanup that other languages have had for decades. Both are lined up for ES2027, and both can be used now, with care. This post says what is in the edition, shows each feature at work with real output from Node.js 24, explains how to adopt early without betting a project on a moving target, and describes how to follow what else is coming. Full coverage of both is in the post on Temporal and the post on explicit resource management. The editions behind this one are in what was new in ES2026.

How a feature reaches an edition

A proposal moves through stages, from an idea at stage 0 to a finished feature at stage 4. Stage 3 means the design is complete and engines are invited to implement it, and stage 4 means two or more engines ship it and tests exist. The yearly edition is a snapshot of the proposals that reached stage 4 before a cutoff in the first months of the year.

StageMeaningSafe to use in production
0 to 2Idea, draft, design in progressNo, the design can change
3Design finished, engines implementingBehind detection, with a fallback
4Shipped in at least two engines, in the next editionYes where your runtime has it

The name of an edition is the year it is published, so ES2027 appears in June 2027 and includes what finished before then. A feature that is "in ES2027" may already run today, as these two do, because engines ship at stage 3 and sometimes earlier. The post on TC39 walks through the process.

using, today

The declaration binds a resource and calls its disposal method when the block ends, even if the block throws. It runs natively on Node.js 24.

JavaScript
const events = [];

function open(name) {
  events.push(`open ${name}`);
  return { [Symbol.dispose]: () => events.push(`close ${name}`) };
}

function work(fail) {
  using first = open("first");
  using second = open("second");
  events.push("working");
  if (fail) throw new Error("work failed");
  return "ok";
}

console.log(work(false));
try {
  work(true);
} catch (error) {
  events.push("caught " + error.message);
}
console.log(events);

console.log(typeof Symbol.dispose, typeof Symbol.asyncDispose, typeof DisposableStack);
Text
ok
[
  'open first',
  'open second',
  'working',
  'close second',
  'close first',
  'open first',
  'open second',
  'working',
  'close second',
  'close first',
  'caught work failed'
]
symbol symbol function

Both resources closed in reverse order on the success path and on the failure path, before the error reached the catch. The detection is the three typeof checks at the end: if the symbols exist, the runtime has the feature, and if the syntax is not supported, the file fails to parse, which is the harder case discussed below. Where the syntax is available, using replaces a try and finally per resource.

Temporal, today

Temporal gives dates, times, instants, zoned times and durations separate immutable types. In Node.js 24 it is behind a flag, and the snippets below were run with --harmony-temporal.

JavaScript
const due = Temporal.PlainDate.from("2026-01-31");

console.log(due.add({ months: 1 }).toString());
console.log(due.until(Temporal.PlainDate.from("2026-03-15"), { largestUnit: "month" }).toString());

const meeting = Temporal.ZonedDateTime.from("2026-03-07T12:00:00[America/New_York]");
console.log(meeting.add({ days: 1 }).toString());
console.log(meeting.add({ hours: 24 }).toString());

const instant = Temporal.Instant.from("2026-05-06T07:08:09Z");
console.log(instant.toZonedDateTimeISO("Asia/Tokyo").toString());

console.log(typeof Temporal, typeof Temporal.Now.instant);
Text
2026-02-28
P1M15D
2026-03-08T12:00:00-04:00[America/New_York]
2026-03-08T13:00:00-04:00[America/New_York]
2026-05-06T16:08:09+09:00[Asia/Tokyo]
object function

Adding a month to January 31 gave the last day of February, the gap between two dates came out in months and days, and the same one-day step across a daylight saving change gave a different wall-clock result from adding 24 hours. These are the behaviors Date cannot express. The details are in the Temporal post.

Adopting early with detection

The rule for using a feature before its edition is to detect, fall back and isolate. Detect with a runtime check, write the fallback once, and put both in one module so that removing the fallback later is a single edit.

JavaScript
const hasTemporal = typeof globalThis.Temporal === "object";
const hasUsing = typeof Symbol.dispose === "symbol";

console.log({ hasTemporal, hasUsing });

function daysBetween(from, to) {
  if (hasTemporal) {
    return Temporal.PlainDate.from(from).until(Temporal.PlainDate.from(to)).days;
  }
  const [y1, m1, d1] = from.split("-").map(Number);
  const [y2, m2, d2] = to.split("-").map(Number);
  return Math.round((Date.UTC(y2, m2 - 1, d2) - Date.UTC(y1, m1 - 1, d1)) / 86_400_000);
}

console.log(daysBetween("2026-01-01", "2026-03-15"));

function withResource(resource, body) {
  try {
    return body(resource);
  } finally {
    resource[Symbol.dispose]?.();
  }
}

const log = [];
withResource({ [Symbol.dispose]: () => log.push("disposed") }, () => log.push("used"));
console.log(log);
Text
{ hasTemporal: true, hasUsing: true }
73
[ 'used', 'disposed' ]

This snippet was run with the --harmony-temporal flag, so the check found Temporal and the function used it. Without the flag, the check is false and the Date.UTC branch runs, which gives the same 73 days: the number is 31 days of January, 28 of February and 14 more in March. The helper withResource does what a using block does, with a plain try and finally, so code that must support runtimes without the syntax can keep one call shape. For syntax, there is no runtime detection: a file containing using fails to parse where it is unsupported, so the choices are to raise the minimum runtime, to compile with TypeScript or Babel, or to avoid the syntax until your floor includes it.

Polyfills and compilers

Temporal has a polyfill that implements the API in JavaScript, so a page can use it in engines that lack it, at the cost of its size, which is large because it carries calendar and time zone logic. Load it conditionally and only where needed. For using, TypeScript 5.2 and later compile the syntax down to try and finally with helper functions, when the target is lower than the feature, and Babel has a plugin that does the same. A compiler is the better route for using, since it handles the syntax, and a polyfill is the route for Temporal, since it is a library.

What else to watch

Beyond these two, the committee keeps a list of proposals by stage, and the finished ones are in a file in the proposals repository that names the edition each landed in. Two habits help in following it. Read the stage before the name: a stage 2 proposal can change shape or disappear, and building on it is a bet. And read the engine status, since a stage 3 proposal that is shipping in two engines is closer than one that is waiting, which is information the stage table alone does not carry.

We keep a short list of proposals we are watching and revisit it when each edition is published. A feature does not enter a post here until it runs, and until its output has been checked on a runtime we name.

A checklist before adopting

Four questions decide whether a pre-edition feature is ready for a project. Does every runtime you must support have it, or do you have a polyfill or compiler for the rest? Does every tool in the pipeline, the linter, the formatter, the bundler and the test runner, parse the syntax? Is the fallback isolated in one place, with a test that runs it? And is there a note in the code saying which edition or version makes the fallback removable? If all four are yes, adopting early costs little and buys cleaner code now. If any is no, wait one release cycle, since the answer usually changes within a year.

Where to be careful

Do not rewrite a project around a feature that has not reached your runtime's stable channel. Do not ship a polyfill unconditionally, since it loads cost for readers whose browsers already have the feature. Do not mix an early feature with an old tool that cannot parse it, which is the failure that appears as a mysterious syntax error in a linter or a test runner, and check that every tool in the pipeline understands the new syntax before using it. And keep an eye on API changes at the margins of an early feature: the property that reads the time zone from a zoned value changed names while Temporal was finalized, and code that was built on an early build had to change.

The edition process is documented in the TC39 process document, and the proposals are tracked in the TC39 proposals repository, where the finished-proposals file lists what shipped in each edition.

Share

Keep reading

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.