Skip to content

Commit 686affb

Browse files
ptomatoMs2ger
authored andcommitted
Fix accidental BigInt-to-Number conversion
This line would accidentally convert the BigInt epoch nanoseconds to Numbers, potentially losing microseconds or nanoseconds, before subtracting. It did not affect any results, because no offset transitions occur on microsecond or nanosecond boundaries.
1 parent d852c7d commit 686affb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

polyfill/lib/ecmascript.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@ export function InterpretISODateTimeOffset(
14551455
const possibleEpochNs = GetPossibleEpochNanoseconds(timeZone, dt);
14561456
for (let index = 0; index < possibleEpochNs.length; index++) {
14571457
const candidate = possibleEpochNs[index];
1458-
const candidateOffset = utcEpochNs - candidate;
1458+
const candidateOffset = utcEpochNs.subtract(candidate).toJSNumber();
14591459
const roundedCandidateOffset = RoundNumberToIncrement(candidateOffset, 60e9, 'halfExpand');
14601460
if (candidateOffset === offsetNs || (matchMinute && roundedCandidateOffset === offsetNs)) {
14611461
return candidate;

0 commit comments

Comments
 (0)