1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 12:17:44 +00:00

LibJS: Remove RegulateISODate after BalanceISODate in AddISODate

This is an editorial change in the Temporal spec.

See: 32b22b1
This commit is contained in:
Linus Groh 2022-06-14 21:44:33 +01:00
parent e96df3b7a7
commit 810e9e32c9

View file

@ -444,19 +444,16 @@ ThrowCompletionOr<ISODateRecord> add_iso_date(GlobalObject& global_object, i32 y
auto intermediate_year_month = balance_iso_year_month(year + years, month + months); auto intermediate_year_month = balance_iso_year_month(year + years, month + months);
// 4. Let intermediate be ? RegulateISODate(intermediate.[[Year]], intermediate.[[Month]], day, overflow). // 4. Let intermediate be ? RegulateISODate(intermediate.[[Year]], intermediate.[[Month]], day, overflow).
auto intermediate_date = TRY(regulate_iso_date(global_object, intermediate_year_month.year, intermediate_year_month.month, day, overflow)); auto intermediate = TRY(regulate_iso_date(global_object, intermediate_year_month.year, intermediate_year_month.month, day, overflow));
// 5. Set days to days + 7 × weeks. // 5. Set days to days + 7 × weeks.
days += 7 * weeks; days += 7 * weeks;
// 6. Let d be intermediate.[[Day]] + days. // 6. Let d be intermediate.[[Day]] + days.
auto d = intermediate_date.day + days; auto d = intermediate.day + days;
// 7. Let intermediate be BalanceISODate(intermediate.[[Year]], intermediate.[[Month]], d). // 7. Return BalanceISODate(intermediate.[[Year]], intermediate.[[Month]], d).
auto intermediate = balance_iso_date(intermediate_date.year, intermediate_date.month, d); return balance_iso_date(intermediate.year, intermediate.month, d);
// 8. Return ? RegulateISODate(intermediate.[[Year]], intermediate.[[Month]], intermediate.[[Day]], overflow).
return regulate_iso_date(global_object, intermediate.year, intermediate.month, intermediate.day, overflow);
} }
// 3.5.10 CompareISODate ( y1, m1, d1, y2, m2, d2 ), https://tc39.es/proposal-temporal/#sec-temporal-compareisodate // 3.5.10 CompareISODate ( y1, m1, d1, y2, m2, d2 ), https://tc39.es/proposal-temporal/#sec-temporal-compareisodate