Skip to content

Commit

Permalink
Possible for InterpretISODateTimeOffset to call GetOffsetNanosecondsF…
Browse files Browse the repository at this point in the history
…or fewer times for prefer/reject
  • Loading branch information
arshaw committed Feb 27, 2024
1 parent 2ff1ed3 commit f383a68
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions polyfill/lib/ecmascript.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1558,12 +1558,24 @@ export function InterpretISODateTimeOffset(
// "prefer" or "reject"
const possibleInstants = GetPossibleInstantsFor(timeZoneRec, dt);
if (possibleInstants.length > 0) {
const utcEpochNs = GetUTCEpochNanoseconds(
year,
month,
day,
hour,
minute,
second,
millisecond,
microsecond,
nanosecond,

Check failure on line 1570 in polyfill/lib/ecmascript.mjs

View workflow job for this annotation

GitHub Actions / lint

Delete `,`

Check failure on line 1570 in polyfill/lib/ecmascript.mjs

View workflow job for this annotation

GitHub Actions / lint

Unexpected trailing comma
);
for (let index = 0; index < possibleInstants.length; index++) {
const candidate = possibleInstants[index];
const candidateOffset = GetOffsetNanosecondsFor(timeZoneRec, candidate);
const candidateEpochNs = GetSlot(candidate, EPOCHNANOSECONDS);
const candidateOffset = utcEpochNs - candidateEpochNs

Check failure on line 1575 in polyfill/lib/ecmascript.mjs

View workflow job for this annotation

GitHub Actions / lint

Insert `;`

Check failure on line 1575 in polyfill/lib/ecmascript.mjs

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon
const roundedCandidateOffset = RoundNumberToIncrement(bigInt(candidateOffset), 60e9, 'halfExpand').toJSNumber();
if (candidateOffset === offsetNs || (matchMinute && roundedCandidateOffset === offsetNs)) {
return GetSlot(candidate, EPOCHNANOSECONDS);
return candidateEpochNs;
}
}
}
Expand Down

0 comments on commit f383a68

Please sign in to comment.