Temporal.PlainTime.prototype.add()

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The add() method of Temporal.PlainTime instances returns a new Temporal.PlainTime object representing this time moved forward by a given duration (in a form convertible by Temporal.Duration.from()), wrapping around the clock if necessary.

Syntax

js
add(duration)

Parameters

duration

A string, an object, or a Temporal.Duration instance representing a duration to add to this time. It is converted to a Temporal.Duration object using the same algorithm as Temporal.Duration.from().

Return value

A new Temporal.PlainTime object representing the time specified by the original PlainTime, plus the duration. Any units above hours are ignored, and if the time goes past midnight, it wraps around to the next day.

Adding a duration is equivalent to subtracting its negation.

Examples

Adding a duration

js
const start = Temporal.PlainTime.from("12:34:56");
const end = start.add({ hours: 1, minutes: 30 });
console.log(end.toString()); // 14:04:56

const end2 = start.add({ hours: -1, minutes: -30 });
console.log(end2.toString()); // 11:04:56

const distance = Temporal.PlainTime.from("00:00:00").until("01:23:45"); // 1h 23m 45s
const end3 = start.add(distance);
console.log(end3.toString()); // 13:58:41

Time wrapping

If the time goes past midnight, it wraps around to the next day:

js
const start = Temporal.PlainTime.from("12:34:56");
const end = start.add({ hours: 12 });
console.log(end.toString()); // 00:34:56

Specifications

Specification
Temporal
# sec-temporal.plaintime.prototype.add

Browser compatibility

desktop mobile server
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Bun
Deno
Node.js
add
Chrome – Full support
Chrome 144 (Release date: 2026-01-13)
footnote Full support
Edge – Full support
Edge 144 (Release date: 2026-01-21)
footnote Full support
Firefox – Full support
Firefox 139 (Release date: 2025-05-27)
footnote Full support
Opera – Full support
Opera 128 (Release date: 2026-02-26)
footnote Full support
Safari – Preview support
Safari TP
footnote
footnote See bug 223166
footnote Preview browser support
Chrome Android – Full support
Chrome Android 144 (Release date: 2026-01-13)
footnote Full support
Firefox for Android – Full support
Firefox for Android 139 (Release date: 2025-05-27)
footnote Full support
Opera Android – Full support
Opera Android 95 (Release date: 2026-02-11)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – Full support
WebView Android 144 (Release date: 2026-01-13)
footnote Full support
WebView on iOS – No support
WebView on iOS
footnote No support
Bun – No support
Bun
footnote No support
Deno – Full support
Deno 2.7 (Release date: 2026-02-25)
footnote Full support
Node.js – No support
Node.js
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
In development. Supported in a pre-release version.
In development. Supported in a pre-release version.
No support
No support
See implementation notes.

See also