const start = Temporal.PlainDateTime.from("2022-01-01T12:34:56");
const end = start.subtract({
years: 1,
months: 2,
weeks: 3,
days: 4,
hours: 5,
minutes: 6,
seconds: 7,
milliseconds: 8,
});
console.log(end.toString()); // 2020-10-07T07:28:48.992Temporal.PlainDateTime.prototype.subtract() / notebook
Temporal.PlainDateTime.prototype.subtract()
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.