You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Temporal.Duration.prototype.round, step 32 sets plainDateTimeOrRelativeToWillBeUsed to true when roundingGranularityIsNoop is false.
It's not clear to me why roundingGranularityIsNoop tested here and if roundingGranularityIsNoop = false is indeed a correct condition, then plainDateTimeOrRelativeToWillBeUsed doesn't need to test smallestUnit, because when smallestUnit is larger or equal to "day", then roundingGranularityIsNoop is guaranteed to be false.
The text was updated successfully, but these errors were encountered:
It's not clear to me why roundingGranularityIsNoop tested here [...]
Ah, I guess it's for AdjustRoundedDurationDays, which has a fast-path to return the input when smallestUnit = "nanosecond" and roundingIncrement = 1 (which is roundingGranularityIsNoop).
Indeed, it's for the fast path in AdjustRoundedDurationDays. You're correct that I missed that the roundingGranularityIsNoop condition subsumes the smallestUnit condition, so I'll remove the latter.
In Duration.p.round(), the smallestUnit condition for precalculating the
PlainDateTime is already subsumed by the roundingGranularityIsNoop
condition, so also checking smallestUnit is redundant.
Thanks to Anba for pointing this out.
Closes: #2698
Temporal.Duration.prototype.round, step 32 sets
plainDateTimeOrRelativeToWillBeUsed
totrue
whenroundingGranularityIsNoop
isfalse
.It's not clear to me why
roundingGranularityIsNoop
tested here and ifroundingGranularityIsNoop = false
is indeed a correct condition, thenplainDateTimeOrRelativeToWillBeUsed
doesn't need to testsmallestUnit
, because whensmallestUnit
is larger or equal to"day"
, thenroundingGranularityIsNoop
is guaranteed to befalse
.The text was updated successfully, but these errors were encountered: