mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-02 04:27:12 +02:00
LibJS: Replace Temporal's BalanceISODate with AddDaysToISODate
This is an editorial change in the Temporal proposal. See: https://github.com/tc39/proposal-temporal/commit/b28ef08
This commit is contained in:
Notes:
github-actions[bot]
2026-01-13 18:03:25 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/3eabdcf4606 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7458
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2021-2023, Luke Wilde <lukew@serenityos.org>
|
||||
* Copyright (c) 2024-2025, Tim Flynn <trflynn89@ladybird.org>
|
||||
* Copyright (c) 2024-2026, Tim Flynn <trflynn89@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
@@ -470,8 +470,8 @@ ThrowCompletionOr<InternalDuration> difference_zoned_date_time(VM& vm, Crypto::S
|
||||
|
||||
// 11. Repeat, while dayCorrection ≤ maxDayCorrection and success is false,
|
||||
while (day_correction <= max_day_correction && !success) {
|
||||
// a. Let intermediateDate be BalanceISODate(endDateTime.[[ISODate]].[[Year]], endDateTime.[[ISODate]].[[Month]], endDateTime.[[ISODate]].[[Day]] - dayCorrection × sign).
|
||||
auto intermediate_date = balance_iso_date(end_date_time.iso_date.year, end_date_time.iso_date.month, static_cast<double>(end_date_time.iso_date.day) - (day_correction * sign));
|
||||
// a. Let intermediateDate be AddDaysToISODate(endDateTime.[[ISODate]], dayCorrection × -sign).
|
||||
auto intermediate_date = add_days_to_iso_date(end_date_time.iso_date, day_correction * -sign);
|
||||
|
||||
// b. Let intermediateDateTime be CombineISODateAndTimeRecord(intermediateDate, startDateTime.[[Time]]).
|
||||
intermediate_date_time = combine_iso_date_and_time_record(intermediate_date, start_date_time.time);
|
||||
|
||||
Reference in New Issue
Block a user