Skip to content

Commit c9b2172

Browse files
committed
Editorial: Replace BalanceISODateTime with subtraction
1 parent c75c841 commit c9b2172

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

spec/instant.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,10 @@ <h1>
413413
1. Assert: Either _parsed_.[[TimeZone]].[[OffsetString]] is not ~empty~ or _parsed_.[[TimeZone]].[[Z]] is *true*, but not both.
414414
1. If _parsed_.[[TimeZone]].[[Z]] is *true*, let _offsetNanoseconds_ be 0; otherwise, let _offsetNanoseconds_ be ! ParseDateTimeUTCOffset(_parsed_.[[TimeZone]].[[OffsetString]]).
415415
1. If _parsed_.[[Time]] is ~start-of-day~, let _time_ be MidnightTimeRecord(); else let _time_ be _parsed_.[[Time]].
416-
1. Let _balanced_ be BalanceISODateTime(_parsed_.[[Year]], _parsed_.[[Month]], _parsed_.[[Day]], _time_.[[Hour]], _time_.[[Minute]], _time_.[[Second]], _time_.[[Millisecond]], _time_.[[Microsecond]], _time_.[[Nanosecond]] - _offsetNanoseconds_).
417-
1. Perform ? CheckISODaysRange(_balanced_.[[ISODate]]).
418-
1. Let _epochNanoseconds_ be GetUTCEpochNanoseconds(_balanced_).
416+
1. Let _isoDate_ be CreateISODateRecord(_parsed_.[[Year]], _parsed_.[[Month]], _parsed_.[[Day]]).
417+
1. Let _isoDateTime_ be CombineISODateAndTimeRecord(_isoDate_, _time_).
418+
1. Perform ? CheckISODaysRange(_isoDate_).
419+
1. Let _epochNanoseconds_ be GetUTCEpochNanoseconds(_isoDateTime_) - _offsetNanoseconds_.
419420
1. If IsValidEpochNanoseconds(_epochNanoseconds_) is *false*, throw a *RangeError* exception.
420421
1. Return ! CreateTemporalInstant(_epochNanoseconds_).
421422
</emu-alg>

spec/timezone.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,9 @@ <h1>
349349
<emu-alg>
350350
1. Let _parseResult_ be ! ParseTimeZoneIdentifier(_timeZone_).
351351
1. If _parseResult_.[[OffsetMinutes]] is not ~empty~, then
352-
1. Let _balanced_ be BalanceISODateTime(_isoDateTime_.[[ISODate]].[[Year]], _isoDateTime_.[[ISODate]].[[Month]], _isoDateTime_.[[ISODate]].[[Day]], _isoDateTime_.[[Time]].[[Hour]], _isoDateTime_.[[Time]].[[Minute]] - _parseResult_.[[OffsetMinutes]], _isoDateTime_.[[Time]].[[Second]], _isoDateTime_.[[Time]].[[Millisecond]], _isoDateTime_.[[Time]].[[Microsecond]], _isoDateTime_.[[Time]].[[Nanosecond]]).
353-
1. Perform ? CheckISODaysRange(_balanced_.[[ISODate]]).
354-
1. Let _epochNanoseconds_ be GetUTCEpochNanoseconds(_balanced_).
352+
1. Let _offsetNanoseconds_ be _parseResult_.[[OffsetMinutes]] × 6 × 10<sup>10</sup>.
353+
1. Perform ? CheckISODaysRange(_isoDateTime_.[[ISODate]]).
354+
1. Let _epochNanoseconds_ be GetUTCEpochNanoseconds(_isoDateTime_) - _offsetNanoseconds_.
355355
1. Let _possibleEpochNanoseconds_ be « _epochNanoseconds_ ».
356356
1. Else,
357357
1. Perform ? CheckISODaysRange(_isoDateTime_.[[ISODate]]).

spec/zoneddatetime.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -915,9 +915,8 @@ <h1>
915915
1. If _offsetBehaviour_ is ~wall~, or _offsetBehaviour_ is ~option~ and _offsetOption_ is ~ignore~, then
916916
1. Return ? GetEpochNanosecondsFor(_timeZone_, _isoDateTime_, _disambiguation_).
917917
1. If _offsetBehaviour_ is ~exact~, or _offsetBehaviour_ is ~option~ and _offsetOption_ is ~use~, then
918-
1. Let _balanced_ be BalanceISODateTime(_isoDate_.[[Year]], _isoDate_.[[Month]], _isoDate_.[[Day]], _time_.[[Hour]], _time_.[[Minute]], _time_.[[Second]], _time_.[[Millisecond]], _time_.[[Microsecond]], _time_.[[Nanosecond]] - _offsetNanoseconds_).
919-
1. Perform ? CheckISODaysRange(_balanced_.[[ISODate]]).
920-
1. Let _epochNanoseconds_ be GetUTCEpochNanoseconds(_balanced_).
918+
1. Perform ? CheckISODaysRange(_isoDate_).
919+
1. Let _epochNanoseconds_ be GetUTCEpochNanoseconds(_isoDateTime_) - _offsetNanoseconds_.
921920
1. If IsValidEpochNanoseconds(_epochNanoseconds_) is *false*, throw a *RangeError* exception.
922921
1. Return _epochNanoseconds_.
923922
1. Assert: _offsetBehaviour_ is ~option~.

0 commit comments

Comments
 (0)