You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/duration.md
+19-22Lines changed: 19 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,7 +90,7 @@ Otherwise, the function will throw a `RangeError`.
90
90
Any non-object value is converted to a string, which is expected to be in ISO 8601 format.
91
91
92
92
> **NOTE:** This function understands strings where weeks and other units are combined, and strings with a single sign character at the start, which are extensions to the ISO 8601 standard described in ISO 8601-2.
93
-
> (For example, `P3W1D` is understood to mean three weeks and one day, `-P1Y1M` is a negative duration of one year and one month, and `+P1Y1M` is one year and one month.)
93
+
> For example, `P3W1D` is understood to mean three weeks and one day, `-P1Y1M` is a negative duration of one year and one month, and `+P1Y1M` is one year and one month.
94
94
> If no sign character is present, then the sign is assumed to be positive.
95
95
96
96
Usage examples:
@@ -421,8 +421,8 @@ This operation is called "balancing."
421
421
For usage examples and a more complete explanation of how balancing works, see [Duration balancing](./balancing.md).
422
422
423
423
A `largestUnit` value of `'auto'`, which is the default if only `smallestUnit` is given, means that `largestUnit` should be the largest nonzero unit in the duration that is larger than `smallestUnit`.
424
-
(For example, in a duration of 3 days and 12 hours, `largestUnit: 'auto'` would mean the same as `largestUnit: 'days'`.)
425
-
This means that the default is for the balancing behaviour of this method to not 'grow' the duration beyond its current largest unit unless needed for rounding.
424
+
For example, in a duration of 3 days and 12 hours, `largestUnit: 'auto'` would mean the same as `largestUnit: 'days'`.
425
+
This behavior implies that the default balancing behaviour of this method to not 'grow' the duration beyond its current largest unit unless needed for rounding.
426
426
427
427
The `smallestUnit` option determines the unit to round to.
428
428
For example, to round to the nearest minute, use `smallestUnit: 'minutes'`.
@@ -437,9 +437,9 @@ The `roundingIncrement` option allows rounding to an integer number of units.
437
437
For example, to round to increments of a half hour, use `smallestUnit: 'minutes', roundingIncrement: 30`.
438
438
439
439
Unless `smallestUnit` is years, months, weeks, or days, the value given as `roundingIncrement` must divide evenly into the next highest unit after `smallestUnit`, and must not be equal to it.
440
-
(For example, if `smallestUnit` is `'minutes'`, then the number of minutes given by `roundingIncrement` must divide evenly into 60 minutes, which is one hour.
440
+
For example, if `smallestUnit` is `'minutes'`, then the number of minutes given by `roundingIncrement` must divide evenly into 60 minutes, which is one hour.
441
441
The valid values in this case are 1 (default), 2, 3, 4, 5, 6, 10, 12, 15, 20, and 30.
442
-
Instead of 60 minutes, use 1 hour.)
442
+
Instead of 60 minutes, use 1 hour.
443
443
444
444
The `roundingMode` option controls how the rounding is performed.
445
445
@@ -475,16 +475,15 @@ d = Temporal.Duration.from('PT2H34M18S');
0 commit comments