Skip to content

Commit 6274e5d

Browse files
committed
Editorial: Revert inadvertent observable change
In #2989 I added checks to prevent calling GetUTCEpochNanoseconds with out-of-range arguments, which, per ECMA-262, is legal but ill-defined. (See tc39/ecma262#1087). These checks should not have changed any observable semantics, just caused some inputs to throw that would have thrown anyway. These checks later became CheckISODateRange. However, in one of the checks I made a mistake: the GetUTCEpochNanoseconds call in GetNamedTimeZoneEpochNanoseconds can never trigger the ill-defined behaviour because the time zone is always UTC in the time-zone-unaware algorithm given there. So the extra check was not necessary, and in fact was incorrect for time-zone-aware implementations, causing an observable change in semantics as they would throw where they previously did not. Since this was an unintended and unwanted change to observable semantics, which was not approved in committee, we must revert it. Web compatibility status: Firefox ships the correct behaviour. Chrome currently ships the broken behaviour, but that has not yet been exposed to the web unflagged. Safari has not implemented this part of the proposal yet.
1 parent 9b64df5 commit 6274e5d

File tree

2 files changed

+0
-2
lines changed

2 files changed

+0
-2
lines changed

polyfill/lib/ecmascript.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1946,7 +1946,6 @@ export function GetPossibleEpochNanoseconds(timeZone, isoDateTime) {
19461946
return [epochNs];
19471947
}
19481948

1949-
CheckISODaysRange(isoDateTime.isoDate);
19501949
return GetNamedTimeZoneEpochNanoseconds(timeZone, isoDateTime);
19511950
}
19521951

spec/timezone.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,6 @@ <h1>
360360
1. Let _epochNanoseconds_ be GetUTCEpochNanoseconds(_balanced_).
361361
1. Let _possibleEpochNanoseconds_ be « _epochNanoseconds_ ».
362362
1. Else,
363-
1. Perform ? CheckISODaysRange(_isoDateTime_.[[ISODate]]).
364363
1. Let _possibleEpochNanoseconds_ be GetNamedTimeZoneEpochNanoseconds(_parseResult_.[[Name]], _isoDateTime_).
365364
1. For each value _epochNanoseconds_ in _possibleEpochNanoseconds_, do
366365
1. If IsValidEpochNanoseconds(_epochNanoseconds_) is *false*, throw a *RangeError* exception.

0 commit comments

Comments
 (0)