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
): either a normal completion containing an integer, or a throw completion
467
-
</h1>
468
-
<dlclass="header">
469
-
<dt>description</dt>
470
-
<dd>It converts _argument_ to an integer representing its Number value, or throws a *RangeError* when that value is not <emu-xrefhref="#integral-number">integral</emu-xref>.</dd>
471
-
</dl>
472
-
<emu-alg>
473
-
1. Let _number_ be ? ToNumber(_argument_).
474
-
1. If _number_ is not an integral Number, throw a *RangeError* exception.
): either a normal completion containing a Duration Record, or a throw completion
484
-
</h1>
485
-
<dlclass="header">
486
-
<dt>description</dt>
487
-
<dd>It converts a given object that represents a Duration into a Duration Record.</dd>
488
-
</dl>
489
-
490
-
<emu-alg>
491
-
1. If _input_ is not an Object, then
492
-
1. If _input_ is a String, throw a *RangeError* exception.
493
-
1. Throw a *TypeError* exception.
494
-
1. Let _result_ be a new Duration Record with each field set to 0.
495
-
1. Let _days_ be ? Get(_input_, *"days"*).
496
-
1. If _days_ is not *undefined*, set _result_.[[Days]] to ? ToIntegerIfIntegral(_days_).
497
-
1. Let _hours_ be ? Get(_input_, *"hours"*).
498
-
1. If _hours_ is not *undefined*, set _result_.[[Hours]] to ? ToIntegerIfIntegral(_hours_).
499
-
1. Let _microseconds_ be ? Get(_input_, *"microseconds"*).
500
-
1. If _microseconds_ is not *undefined*, set _result_.[[Microseconds]] to ? ToIntegerIfIntegral(_microseconds_).
501
-
1. Let _milliseconds_ be ? Get(_input_, *"milliseconds"*).
502
-
1. If _milliseconds_ is not *undefined*, set _result_.[[Milliseconds]] to ? ToIntegerIfIntegral(_milliseconds_).
503
-
1. Let _minutes_ be ? Get(_input_, *"minutes"*).
504
-
1. If _minutes_ is not *undefined*, set _result_.[[Minutes]] to ? ToIntegerIfIntegral(_minutes_).
505
-
1. Let _months_ be ? Get(_input_, *"months"*).
506
-
1. If _months_ is not *undefined*, set _result_.[[Months]] to ? ToIntegerIfIntegral(_months_).
507
-
1. Let _nanoseconds_ be ? Get(_input_, *"nanoseconds"*).
508
-
1. If _nanoseconds_ is not *undefined*, set _result_.[[Nanoseconds]] to ? ToIntegerIfIntegral(_nanoseconds_).
509
-
1. Let _seconds_ be ? Get(_input_, *"seconds"*).
510
-
1. If _seconds_ is not *undefined*, set _result_.[[Seconds]] to ? ToIntegerIfIntegral(_seconds_).
511
-
1. Let _weeks_ be ? Get(_input_, *"weeks"*).
512
-
1. If _weeks_ is not *undefined*, set _result_.[[Weeks]] to ? ToIntegerIfIntegral(_weeks_).
513
-
1. Let _years_ be ? Get(_input_, *"years"*).
514
-
1. If _years_ is not *undefined*, set _result_.[[Years]] to ? ToIntegerIfIntegral(_years_).
515
-
1. If _years_, _months_, _weeks_, _days_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, and _nanoseconds_ are all *undefined*, throw a *TypeError* exception.
516
-
1. If IsValidDuration( _result_.[[Years]], _result_.[[Months]], _result_.[[Weeks]], _result_.[[Days]], _result_.[[Hours]], _result_.[[Minutes]], _result_.[[Seconds]], _result_.[[Milliseconds]], _result_.[[Microseconds]], _result_.[[Nanoseconds]]) is *false*, then
<dd>It returns 1 if the most significant non-zero field in the _duration_ argument is positive, and -1 if the most significant non-zero field is negative. If all of _duration_'s fields are zero, it returns 0.</dd>
531
-
</dl>
532
-
<emu-alg>
533
-
1. For each value _v_ of « _duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]] », do
1. NOTE: The above step cannot be implemented directly using floating-point arithmetic. Multiplying by 10<sup>-3</sup>, 10<sup>-6</sup>, and 10<sup>-9</sup> respectively may be imprecise when _milliseconds_, _microseconds_, or _nanoseconds_ is an unsafe integer. This multiplication can be implemented in C++ with an implementation of `std::remquo()` with sufficient bits in the quotient. String manipulation will also give an exact result, since the multiplication is by a power of 10.
574
-
1. If abs(_normalizedSeconds_) ≥ 2<sup>53</sup>, return *false*.
1. For each row of <emu-xrefhref="#table-partition-duration-format-pattern"></emu-xref>, except the header row, in table order, do
682
-
1. Let _unitOptions_ be the value of _durationFormat_'s internal slot whose name is the Internal Slot value of the current row.
491
+
1. Let _unitOptions_ be the value of _durationFormat_'s internal slot whose name is the "Formatter Internal Slot" value of the current row.
683
492
1. If _unitOptions_.[[Style]] is *"fractional"*, then
684
493
1. Let _unit_ be the Unit value of the current row.
685
494
1.Assert: IsFractionalSecondUnitName(_unit_) is *true*.
686
-
1. Let _value_ be the value of _duration_'s field whose name is the Value Field value of the current row.
495
+
1. Let _value_ be the value of _duration_'s internal slot whose name is the "Duration Internal Slot" value of the current row.
687
496
1. Set _result_ to _result_ + (_value_ / 10<sup>_exponent_</sup>).
688
497
1. Set _exponent_ to _exponent_ + 3.
689
498
1. Return _result_.
@@ -829,7 +638,7 @@ <h1>
829
638
<h1>
830
639
FormatNumericUnits (
831
640
_durationFormat_: a DurationFormat Object,
832
-
_duration_: a Duration Record,
641
+
_duration_: a Temporal.Duration,
833
642
_firstNumericUnit_: a String,
834
643
_signDisplayed_: a Boolean,
835
644
): a List of Records
@@ -946,7 +755,7 @@ <h1>
946
755
<h1>
947
756
PartitionDurationFormatPattern (
948
757
_durationFormat_: a DurationFormat,
949
-
_duration_: a Duration Record,
758
+
_duration_: a Temporal.Duration,
950
759
): a List
951
760
</h1>
952
761
<dlclass="header">
@@ -959,8 +768,8 @@ <h1>
959
768
1. Let _signDisplayed_ be *true*.
960
769
1. Let _numericUnitFound_ be *false*.
961
770
1. While _numericUnitFound_ is *false*, repeat for each row in <emu-xrefhref="#table-partition-duration-format-pattern"></emu-xref> in table order, except the header row:
962
-
1. Let _value_ be the value of _duration_'s field whose name is the Value Field value of the current row.
963
-
1. Let _unitOptions_ be the value of _durationFormat_'s internal slot whose name is the Internal Slot value of the current row.
771
+
1. Let _value_ be the value of _duration_'s internal slot whose name is the "Duration Internal Slot" value of the current row.
772
+
1. Let _unitOptions_ be the value of _durationFormat_'s internal slot whose name is the "Formatter Internal Slot" value of the current row.
964
773
1. Let _style_ be _unitOptions_.[[Style]].
965
774
1. Let _display_ be _unitOptions_.[[Display]].
966
775
1. Let _unit_ be the Unit value of the current row.
0 commit comments