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
Editorial: Align DifferenceTemporalInstant with similar AOs (#2241)
This commit editorially refactors DifferenceTemporalInstant to use a
similar algorithm to what's used in other Difference* AOs like
DifferenceTemporalPlainTime and DifferenceTemporalPlainDateTime.
Copy file name to clipboardExpand all lines: spec/instant.html
+5-8Lines changed: 5 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -652,25 +652,22 @@ <h1>
652
652
<dd>It computes the difference between the two times represented by _instant_ and _other_, optionally rounds it, and returns it as a Temporal.Duration object.</dd>
653
653
</dl>
654
654
<emu-alg>
655
+
1. If _operation_ is ~since~, let _sign_ be -1. Otherwise, let _sign_ be 1.
655
656
1. Set _other_ to ? ToTemporalInstant(_other_).
656
-
1. If _operation_ is ~until~, then
657
-
1. Let _first_ be _instant_.
658
-
1. Let _second_ be _other_.
659
-
1. Else,
660
-
1. Let _first_ be _other_.
661
-
1. Let _second_ be _instant_.
662
657
1. Set _options_ to ? GetOptionsObject(_options_).
663
658
1. Let _smallestUnit_ be ? ToSmallestTemporalUnit(_options_, « *"year"*, *"month"*, *"week"*, *"day"* », *"nanosecond"*).
664
659
1. Let _defaultLargestUnit_ be ! LargerOfTwoTemporalUnits(*"second"*, _smallestUnit_).
665
660
1. Let _largestUnit_ be ? ToLargestTemporalUnit(_options_, « *"year"*, *"month"*, *"week"*, *"day"* », *"auto"*, _defaultLargestUnit_).
0 commit comments