diff options
author | Linus Groh <mail@linusgroh.de> | 2021-12-18 17:13:11 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-12-18 22:32:39 +0000 |
commit | 70e6eae27b46f69a7dcded3dd21f92e7bab857f4 (patch) | |
tree | fbd8fa2af14988306a250eb23cd52619ae34ab19 /Userland/Libraries/LibJS | |
parent | 7270bbb25547f165e6a12609e8ea76736dcdffe5 (diff) | |
download | serenity-70e6eae27b46f69a7dcded3dd21f92e7bab857f4.zip |
LibJS: Fix off-by-one in balance_iso_date() for leap year inputs
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/5ab1822
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp index 3bfa9d2508..d4dbc64084 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp @@ -440,8 +440,8 @@ ISODate balance_iso_date(double year_, double month_, double day) // 9. NOTE: To deal with numbers of days greater than the number of days in a year, the following section adds years and subtracts days until the number of days is less than 366 or 365. - // 10. Let testYear be year + 1. - test_year = year + 1; + // 10. Let testYear be testYear + 1. + test_year += 1; // 11. Repeat, while day > ! ISODaysInYear(testYear), while (day > iso_days_in_year(test_year)) { |