Skip to content

Commit

Permalink
Editorial: Remove unused algorithm steps
Browse files Browse the repository at this point in the history
Follow up from #2822. Once again thanks to Anba for spotting this.
  • Loading branch information
ptomato authored and Ms2ger committed May 6, 2024
1 parent cb21bcc commit c0be58d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
12 changes: 1 addition & 11 deletions polyfill/lib/ecmascript.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3898,15 +3898,7 @@ export function DifferenceISODateTime(
return { years, months, weeks, days, norm: timeDuration };
}

export function DifferenceZonedDateTime(
ns1,
ns2,
timeZoneRec,
calendarRec,
largestUnit,
options,
precalculatedDtStart = undefined
) {
export function DifferenceZonedDateTime(ns1, ns2, timeZoneRec, calendarRec, largestUnit, options, dtStart) {
// getOffsetNanosecondsFor and getPossibleInstantsFor must be looked up
// dateAdd must be looked up if the instants are not identical (and the date
// difference has no years, months, or weeks, which can't be determined)
Expand All @@ -3926,9 +3918,7 @@ export function DifferenceZonedDateTime(

// Convert start/end instants to datetimes
const TemporalInstant = GetIntrinsic('%Temporal.Instant%');
const start = new TemporalInstant(ns1);
const end = new TemporalInstant(ns2);
const dtStart = precalculatedDtStart ?? GetPlainDateTimeFor(timeZoneRec, start, calendarRec.receiver);
const dtEnd = GetPlainDateTimeFor(timeZoneRec, end, calendarRec.receiver);

// Simulate moving ns1 as many years/months/weeks/days as possible without
Expand Down
7 changes: 1 addition & 6 deletions spec/zoneddatetime.html
Original file line number Diff line number Diff line change
Expand Up @@ -1422,7 +1422,7 @@ <h1>
_calendarRec_: a Calendar Methods Record,
_largestUnit_: a String,
_options_: an ordinary Object for which the value of the [[Prototype]] internal slot is *null* and every property is a data property,
_precalculatedPlainDateTime_: a Temporal.PlainDateTime,
_startDateTime_: a Temporal.PlainDateTime,
): either a normal completion containing a Normalized Duration Record, or a throw completion
</h1>
<dl class="header">
Expand All @@ -1435,11 +1435,6 @@ <h1>
<emu-alg>
1. If _ns1_ is _ns2_, then
1. Return ! CreateNormalizedDurationRecord(0, 0, 0, 0, ZeroTimeDuration()).
1. If _precalculatedPlainDateTime_ is *undefined*, then
1. Let _startInstant_ be ! CreateTemporalInstant(_ns1_).
1. Let _startDateTime_ be ? GetPlainDateTimeFor(_timeZoneRec_, _startInstant_, _calendarRec_.[[Receiver]]).
1. Else,
1. Let _startDateTime_ be _precalculatedPlainDateTime_.
1. Let _endInstant_ be ! CreateTemporalInstant(_ns2_).
1. Let _endDateTime_ be ? GetPlainDateTimeFor(_timeZoneRec_, _endInstant_, _calendarRec_.[[Receiver]]).
1. If _ns2_ - _ns1_ &lt; 0, let _sign_ be -1; else let _sign_ be 1.
Expand Down

0 comments on commit c0be58d

Please sign in to comment.