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
_timeZone_: an available time zone identifier or ~unset~,
1576
1575
_calendar_: a calendar type,
1577
1576
_increment_: a positive integer,
1578
1577
_unit_: a date unit,
1579
-
_roundingMode_: a rounding mode,
1580
-
): either a normal completion containing a Record with fields [[NudgeResult]] (a Duration Nudge Result Record) and [[Total]] (a mathematical value), or a throw completion
1578
+
_additionalShift_: a Boolean,
1579
+
): either a normal completion containing a Record with fields [[R1]] (a mathematical value), [[R2]] (a mathematical value), [[StartEpochNs]] (a BigInt), [[EndEpochNs]] (a BigInt), [[StartDuration]] (an Internal Duration Record), and [[EndDuration]] (an Internal Duration Record), or a throw completion
1581
1580
</h1>
1582
1581
<dlclass="header">
1583
1582
<dt>description</dt>
1584
1583
<dd>
1585
-
It implements rounding a duration to an increment of a calendar unit, relative to a starting point, by calculating the upper and lower bounds of the starting point added to the duration in epoch nanoseconds, and rounding according to which one is closer to _destEpochNs_.
1584
+
It implements calculating the upper and lower bounds of the starting point added to the duration in epoch nanoseconds.
1586
1585
</dd>
1587
1586
</dl>
1588
1587
<emu-alg>
1589
1588
1. If _unit_ is ~year~, then
1590
1589
1. Let _years_ be RoundNumberToIncrement(_duration_.[[Date]].[[Years]], _increment_, ~trunc~).
1591
-
1. Let _r1_ be _years_.
1592
-
1. Let _r2_ be _years_ + _increment_ × _sign_.
1590
+
1. If _additionalShift_ is *false*, then
1591
+
1. Let _r1_ be _years_.
1592
+
1. Else,
1593
+
1. Let _r1_ be _years_ + _increment_ × _sign_.
1594
+
1. Let _r2_ be _r1_ + _increment_ × _sign_.
1593
1595
1. Let _startDuration_ be ? CreateDateDurationRecord(_r1_, 0, 0, 0).
1594
1596
1. Let _endDuration_ be ? CreateDateDurationRecord(_r2_, 0, 0, 0).
1595
1597
1. Else if _unit_ is ~month~, then
1596
1598
1. Let _months_ be RoundNumberToIncrement(_duration_.[[Date]].[[Months]], _increment_, ~trunc~).
1597
-
1. Let _r1_ be _months_.
1598
-
1. Let _r2_ be _months_ + _increment_ × _sign_.
1599
+
1. If _additionalShift_ is *false*, then
1600
+
1. Let _r1_ be _months_.
1601
+
1. Else,
1602
+
1. Let _r1_ be _months_ + _increment_ × _sign_.
1603
+
1. Let _r2_ be _r1_ + _increment_ × _sign_.
1599
1604
1. Let _startDuration_ be ? AdjustDateDurationRecord(_duration_.[[Date]], 0, 0, _r1_).
1600
1605
1. Let _endDuration_ be ? AdjustDateDurationRecord(_duration_.[[Date]], 0, 0, _r2_).
1601
1606
1. Else if _unit_ is ~week~, then
@@ -1632,10 +1637,52 @@ <h1>
1632
1637
1. Let _endEpochNs_ be GetUTCEpochNanoseconds(_endDateTime_).
1633
1638
1. Else,
1634
1639
1. Let _endEpochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _endDateTime_, ~compatible~).
1640
+
1. Return the Record { [[R1]]: _r1_, [[R2]]: _r2_, [[StartEpochNs]]: _startEpochNs_, [[EndEpochNs]]: _endEpochNs_, [[StartDuration]]: _startDuration_, [[EndDuration]]: _endDuration_ }.
_timeZone_: an available time zone identifier or ~unset~,
1653
+
_calendar_: a calendar type,
1654
+
_increment_: a positive integer,
1655
+
_unit_: a date unit,
1656
+
_roundingMode_: a rounding mode,
1657
+
): either a normal completion containing a Record with fields [[NudgeResult]] (a Duration Nudge Result Record) and [[Total]] (a mathematical value), or a throw completion
1658
+
</h1>
1659
+
<dlclass="header">
1660
+
<dt>description</dt>
1661
+
<dd>
1662
+
It implements rounding a duration to an increment of a calendar unit, relative to a starting point, by calculating the upper and lower bounds of the starting point added to the duration in epoch nanoseconds, and rounding according to which one is closer to _destEpochNs_.
1663
+
</dd>
1664
+
</dl>
1665
+
<emu-alg>
1666
+
1. Let _didExpandCalendarUnit_ be *false*.
1667
+
1. Let _nudgeWindow_ be ? ComputeNudgeWindow(_sign_, _duration_, _originEpochNs_, _isoDateTime_, _timeZone_, _calendar_, _increment_, _unit_, *false*).
1668
+
1. Let _startEpochNs_ be _nudgeWindow_.[[StartEpochNs]].
1669
+
1. Let _endEpochNs_ be _nudgeWindow_.[[EndEpochNs]].
0 commit comments