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: Move string-parsing code into ToTemporalDurationRecord
This code is repeated at both of the pre-existing call sites of
ToTemporalDurationRecord, so it makes sense to move it into
ToTemporalDurationRecord.
With that, ToLimitedTemporalDuration with an empty List of disallowed
fields becomes equivalent to ToTemporalDurationRecord, so make that change
as well. Now, ToLimitedTemporalDuration is only used where the allowed
fields are actually limited: in Instant.prototype.add and subtract.
<dd>It returns its argument _item_ if it is already a Temporal.Duration instance, converts _item_ to a new Temporal.Duration instance if possible and returns that, and throws otherwise.</dd>
914
914
</dl>
915
915
<emu-alg>
916
-
1. If Type(_item_) is Object, then
917
-
1. If _item_ has an [[InitializedTemporalDuration]] internal slot, then
918
-
1. Return _item_.
919
-
1. Let _result_ be ? ToTemporalDurationRecord(_item_).
920
-
1. Else,
921
-
1. Let _string_ be ? ToString(_item_).
922
-
1. Let _result_ be ? ParseTemporalDurationString(_string_).
916
+
1. If Type(_item_) is Object and _item_ has an [[InitializedTemporalDuration]] internal slot, then
917
+
1. Return _item_.
918
+
1. Let _result_ be ? ToTemporalDurationRecord(_item_).
<dd>It converts _temporalDurationLike_ to a Duration Record, and returns it, ensuring that all of the fields listed in _disallowedFields_ are zero.</dd>
1785
1784
</dl>
1786
1785
<emu-alg>
1787
-
1. If Type(_temporalDurationLike_) is not Object, then
1788
-
1. Let _str_ be ? ToString(_temporalDurationLike_).
1789
-
1. Let _duration_ be ? ParseTemporalDurationString(_str_).
1790
-
1. Else,
1791
-
1. Let _duration_ be ? ToTemporalDurationRecord(_temporalDurationLike_).
1786
+
1. Let _duration_ be ? ToTemporalDurationRecord(_temporalDurationLike_).
1792
1787
1. For each row of <emu-xrefhref="#table-temporal-duration-record-fields"></emu-xref>, except the header row, in table order, do
1793
1788
1. Let _prop_ be the Property Name value of the current row.
1794
1789
1. Let _value_ be _duration_'s field whose name is the Field Name value of the current row.
0 commit comments