Temporal Arithmetic
Temporal values are immutable. Add returns a new value and leaves the original unchanged.
Where to run this
This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.
A practical example
if (typeof Temporal === "undefined") {
console.log("Temporal is not available in this runtime. Use a supporting browser or a reviewed local polyfill.");
} else {
const start = Temporal.PlainDate.from("2026-11-07");
const next = start.add({days: 1});
console.log(start.toString(), next.toString());
}
What happens
The original remains the seventh and the new date is the eighth.