Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normative: Make PlainDate difference methods units handling consistent
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
- Loading branch information