Skip to content

Commit c12d20d

Browse files
anbaptomato
authored andcommitted
Normative: Check for invalid epoch nanoseconds in DisambiguatePossibleInstants
Fixes #2236
1 parent f1f016e commit c12d20d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

spec/timezone.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,8 +702,12 @@ <h1>DisambiguatePossibleInstants ( _possibleInstants_, _timeZone_, _dateTime_, _
702702
1. If _disambiguation_ is *"reject"*, then
703703
1. Throw a *RangeError* exception.
704704
1. Let _epochNanoseconds_ be GetEpochFromISOParts(_dateTime_.[[ISOYear]], _dateTime_.[[ISOMonth]], _dateTime_.[[ISODay]], _dateTime_.[[ISOHour]], _dateTime_.[[ISOMinute]], _dateTime_.[[ISOSecond]], _dateTime_.[[ISOMillisecond]], _dateTime_.[[ISOMicrosecond]], _dateTime_.[[ISONanosecond]]).
705-
1. Let _dayBefore_ be ! CreateTemporalInstant(_epochNanoseconds_ - ℤ(nsPerDay)).
706-
1. Let _dayAfter_ be ! CreateTemporalInstant(_epochNanoseconds_ + ℤ(nsPerDay)).
705+
1. Let _dayBeforeNs_ be _epochNanoseconds_ - ℤ(nsPerDay).
706+
1. If ! IsValidEpochNanoseconds(_dayBeforeNs_) is *false*, throw a *RangeError* exception.
707+
1. Let _dayBefore_ be ! CreateTemporalInstant(_dayBeforeNs_).
708+
1. Let _dayAfterNs_ be _epochNanoseconds_ + ℤ(nsPerDay).
709+
1. If ! IsValidEpochNanoseconds(_dayAfterNs_) is *false*, throw a *RangeError* exception.
710+
1. Let _dayAfter_ be ! CreateTemporalInstant(_dayAfterNs_).
707711
1. Let _offsetBefore_ be ? GetOffsetNanosecondsFor(_timeZone_, _dayBefore_).
708712
1. Let _offsetAfter_ be ? GetOffsetNanosecondsFor(_timeZone_, _dayAfter_).
709713
1. Let _nanoseconds_ be _offsetAfter_ - _offsetBefore_.

0 commit comments

Comments
 (0)