From 5c0c1e507c431d1e11f4b51e718853a4901bd1f9 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Thu, 5 Dec 2024 09:48:46 -0500 Subject: [PATCH] LibJS: Reverse date comparison in DifferenceISODateTime This is an editorial change in the Temporal proposal. See: https://github.com/tc39/proposal-temporal/commit/4a8cdb5 --- Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp b/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp index 4c87b7461da..62293e53451 100644 --- a/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp +++ b/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp @@ -300,14 +300,14 @@ InternalDuration difference_iso_date_time(VM& vm, ISODateTime const& iso_date_ti // 4. Let timeSign be TimeDurationSign(timeDuration). auto time_sign = time_duration_sign(time_duration); - // 5. Let dateSign be CompareISODate(isoDateTime2.[[ISODate]], isoDateTime1.[[ISODate]]). - auto date_sign = compare_iso_date(iso_date_time2.iso_date, iso_date_time1.iso_date); + // 5. Let dateSign be CompareISODate(isoDateTime1.[[ISODate]], isoDateTime2.[[ISODate]]). + auto date_sign = compare_iso_date(iso_date_time1.iso_date, iso_date_time2.iso_date); // 6. Let adjustedDate be isoDateTime2.[[ISODate]]. auto adjusted_date = iso_date_time2.iso_date; - // 7. If timeSign = -dateSign, then - if (time_sign == -date_sign) { + // 7. If timeSign = dateSign, then + if (time_sign == date_sign) { // a. Set adjustedDate to BalanceISODate(adjustedDate.[[Year]], adjustedDate.[[Month]], adjustedDate.[[Day]] + timeSign). adjusted_date = balance_iso_date(adjusted_date.year, adjusted_date.month, static_cast(adjusted_date.day) + time_sign);