Skip to content

Commit

Permalink
Editorial: Remove use of nonexistent [[TotalNanoseconds]] field
Browse files Browse the repository at this point in the history
These are two lingering references to when time durations were a Record
with a [[TotalNanoseconds]] field.

Closes: #3021
  • Loading branch information
ptomato committed Oct 31, 2024
1 parent 72104ac commit 2fe690a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion polyfill/lib/zoneddatetime.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ export class ZonedDateTime {

const dayLengthNs = endNs.subtract(startNs);
const dayProgressNs = TimeDuration.fromEpochNsDiff(thisNs, startNs);
epochNanoseconds = dayProgressNs.round(dayLengthNs, roundingMode).add(new TimeDuration(startNs)).totalNs;
const roundedDayNs = dayProgressNs.round(dayLengthNs, roundingMode);
epochNanoseconds = roundedDayNs.addToEpochNs(startNs);
} else {
// smallestUnit < day
// Round based on ISO-calendar time units
Expand Down
2 changes: 1 addition & 1 deletion spec/plaindatetime.html
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ <h1>
1. If CompareISODateTime(_isoDateTime1_, _isoDateTime2_) = 0, then
1. Return 0.
1. Let _diff_ be ? DifferenceISODateTime(_isoDateTime1_, _isoDateTime2_, _calendar_, _unit_).
1. If _unit_ is ~nanosecond~, return _diff_.[[Time]].[[TotalNanoseconds]].
1. If _unit_ is ~nanosecond~, return _diff_.[[Time]].
1. Let _destEpochNs_ be GetUTCEpochNanoseconds(_isoDateTime2_).
1. Return ? TotalRelativeDuration(_diff_, _destEpochNs_, _isoDateTime1_, ~unset~, _calendar_, _unit_).
</emu-alg>
Expand Down
2 changes: 1 addition & 1 deletion spec/zoneddatetime.html
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ <h1>Temporal.ZonedDateTime.prototype.round ( _roundTo_ )</h1>
1. Let _dayLengthNs_ be ℝ(_endNs_ - _startNs_).
1. Let _dayProgressNs_ be TimeDurationFromEpochNanosecondsDifference(_thisNs_, _startNs_).
1. Let _roundedDayNs_ be ! RoundTimeDurationToIncrement(_dayProgressNs_, _dayLengthNs_, _roundingMode_).
1. Let _epochNanoseconds_ be _startNs_ + _roundedDayNs_.[[TotalNanoseconds]].
1. Let _epochNanoseconds_ be AddTimeDurationToEpochNanoseconds(_startNs_, _roundedDayNs_).
1. Else,
1. Let _roundResult_ be RoundISODateTime(_isoDateTime_, _roundingIncrement_, _smallestUnit_, _roundingMode_).
1. Let _offsetNanoseconds_ be GetOffsetNanosecondsFor(_timeZone_, _thisNs_).
Expand Down

0 comments on commit 2fe690a

Please sign in to comment.