Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normative: Correct PlainYearMonth arithmetic for non-ISO calendars
Previously, the algorithm would mix a day in calendar space with a month and year in ISO space. An example of where this would go wrong immediately would be subtracting a duration from a PlainYearMonth from a calendar where the month occurred in ISO February but had more days in it than ISO February. For example, calendar = Temporal.Calendar.from('chinese'); m = Temporal.PlainYearMonth.from({ year: 2021, month: 1, calendar }) // (internally results in ISO reference date 2021-02-12) m.daysInMonth // => 29 m.subtract({ months: 1 }) This would previously try to call CreateTemporalDate(2021, 2, 29) and fail due to mixing the day 29 in Chinese calendar space with year and month in ISO calendar space. However, in most cases this wouldn't even throw, but just produce wrong results. This was already handled correctly in the polyfill, but should have a test262 test written for it.
- Loading branch information