Skip to main content
Temporal.DifferenceOptions.largestUnit - Temporal - Web documentation
property Temporal.DifferenceOptions.largestUnit

The largest unit to allow in the resulting Temporal.Duration object.

Larger units will be "balanced" into smaller units. For example, if largestUnit is 'minute' then a two-hour duration will be output as a 120-minute duration.

Valid values may include 'year', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond', 'microsecond', 'nanosecond' and 'auto', although some types may throw an exception if a value is used that would produce an invalid result. For example, hours is not accepted by Temporal.PlainDate.prototype.since().

The default is always 'auto', though the meaning of this depends on the type being used.

Type

Back to top