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
While I debug my v8 implementation test breakage I think I found a spec bug. Not 100% sure.
The test is built-ins/Temporal/PlainDate/prototype/since/roundingmode-undefined.js
const earlier = new Temporal.PlainDate(2000, 1, 1);
To bring the default for largestUnit in PlainDate's since() and until()
methods in line with other types' since() and until() methods, we have to
add an algorithm step for LargerOfTwoTemporalUnits.
Without this, code such as
date1.until(date2, { smallestUnit: 'months' })
would throw because the default largestUnit is days. As per
#827 (comment)
this was not intended.
PlainDate seems to be the only place where this was not working as
intended. ZonedDateTime, Instant, PlainTime, PlainYearMonth, and
PlainDateTime either already have this step or their default largestUnit
is already the largest one so they wouldn't have this problem.
The reference polyfill code is already correct in this regard.
Closes: #1864
To bring the default for largestUnit in PlainDate's since() and until()
methods in line with other types' since() and until() methods, we have to
add an algorithm step for LargerOfTwoTemporalUnits.
Without this, code such as
date1.until(date2, { smallestUnit: 'months' })
would throw because the default largestUnit is days. As per
#827 (comment)
this was not intended.
PlainDate seems to be the only place where this was not working as
intended. ZonedDateTime, Instant, PlainTime, PlainYearMonth, and
PlainDateTime either already have this step or their default largestUnit
is already the largest one so they wouldn't have this problem.
The reference polyfill code is already correct in this regard.
Closes: #1864
While I debug my v8 implementation test breakage I think I found a spec bug. Not 100% sure.
The test is built-ins/Temporal/PlainDate/prototype/since/roundingmode-undefined.js
const earlier = new Temporal.PlainDate(2000, 1, 1);
const later1 = new Temporal.PlainDate(2005, 2, 20);
const explicit1 = later1.since(earlier, { smallestUnit: "year", roundingMode: undefined });
I got a throw in the since line
look at
https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype.since
After step 7 smallestUnit will be "year".
After step 8 largestUnit will be "day"
And inside step 9 it will throw.
The spec look similar in until
should we change step 8 to
instead?
@ptomato @ljharb @Ms2ger @jugglinmike @ryzokuken
The text was updated successfully, but these errors were encountered: