Skip to content

Commit ff968bd

Browse files
committed
Editorial: Rename UnbalanceDateDurationRelative to DateDurationDays
This operation used to do more than just calculate the number of days, and the name used to make more sense when we had BalanceRelative, etc. Now it's just confusing. Rename it to reflect what it does. See: #2953
1 parent 5e95761 commit ff968bd

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

polyfill/lib/duration.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,8 @@ export class Duration {
420420
if (!plainRelativeTo) {
421421
throw new RangeErrorCtor('A starting point is required for years, months, or weeks comparison');
422422
}
423-
d1 = ES.UnbalanceDateDurationRelative(duration1.date, plainRelativeTo);
424-
d2 = ES.UnbalanceDateDurationRelative(duration2.date, plainRelativeTo);
423+
d1 = ES.DateDurationDays(duration1.date, plainRelativeTo);
424+
d2 = ES.DateDurationDays(duration2.date, plainRelativeTo);
425425
}
426426
const norm1 = duration1.norm.add24HourDays(d1);
427427
const norm2 = duration2.norm.add24HourDays(d2);

polyfill/lib/ecmascript.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2685,7 +2685,7 @@ export function BalanceTime(hour, minute, second, millisecond, microsecond, nano
26852685
return { deltaDays, hour, minute, second, millisecond, microsecond, nanosecond };
26862686
}
26872687

2688-
export function UnbalanceDateDurationRelative(dateDuration, plainRelativeTo) {
2688+
export function DateDurationDays(dateDuration, plainRelativeTo) {
26892689
const yearsMonthsWeeksDuration = AdjustDateDurationRecord(dateDuration, 0);
26902690
if (DateDurationSign(yearsMonthsWeeksDuration) === 0) return dateDuration.days;
26912691

spec/duration.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ <h1>Temporal.Duration.compare ( _one_, _two_ [ , _options_ ] )</h1>
105105
1. Return *+0*<sub>𝔽</sub>.
106106
1. If IsCalendarUnit(_largestUnit1_) is *true* or IsCalendarUnit(_largestUnit2_) is *true*, then
107107
1. If _plainRelativeTo_ is *undefined*, throw a *RangeError* exception.
108-
1. Let _days1_ be ? UnbalanceDateDurationRelative(_duration1_.[[Date]], _plainRelativeTo_).
109-
1. Let _days2_ be ? UnbalanceDateDurationRelative(_duration2_.[[Date]], _plainRelativeTo_).
108+
1. Let _days1_ be ? DateDurationDays(_duration1_.[[Date]], _plainRelativeTo_).
109+
1. Let _days2_ be ? DateDurationDays(_duration2_.[[Date]], _plainRelativeTo_).
110110
1. Else,
111111
1. Let _days1_ be _one_.[[Days]].
112112
1. Let _days2_ be _two_.[[Days]].
@@ -1557,9 +1557,9 @@ <h1>ZeroTimeDuration ( ): a Normalized Time Duration Record</h1>
15571557
</emu-alg>
15581558
</emu-clause>
15591559

1560-
<emu-clause id="sec-temporal-unbalancedatedurationrelative" type="abstract operation">
1560+
<emu-clause id="sec-temporal-datedurationdays" type="abstract operation">
15611561
<h1>
1562-
UnbalanceDateDurationRelative (
1562+
DateDurationDays (
15631563
_dateDuration_: a Date Duration Record,
15641564
_plainRelativeTo_: a Temporal.PlainDate,
15651565
): either a normal completion containing an integer or a throw completion

0 commit comments

Comments
 (0)