Commit edb902d9 authored by Frank Tang's avatar Frank Tang Committed by V8 LUCI CQ

[Temporal] Fix bug in RoundDuration

Access the correct years, months and weeks which modified previously
instead of the value from the input.

Spec text:
https://tc39.es/proposal-temporal/#sec-temporal-roundduration

Bug: v8:11544
Change-Id: I2ffaca5545e2359bc1cc03320068424bba4c7907
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3860649Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83045}
parent 87ce9fce
......@@ -9102,7 +9102,7 @@ Maybe<DurationRecordWithRemainder> RoundDuration(Isolate* isolate,
double one_year_days = move_result.days;
// y. Let fractionalYears be years + days / abs(oneYearDays).
double fractional_years =
duration.years +
result.record.years +
result.record.time_duration.days / std::abs(one_year_days);
// z. Set years to RoundNumberToIncrement(fractionalYears, increment,
// roundingMode).
......@@ -9218,7 +9218,7 @@ Maybe<DurationRecordWithRemainder> RoundDuration(Isolate* isolate,
}
// o. Let fractionalMonths be months + days / abs(oneMonthDays).
double fractional_months =
duration.months +
result.record.months +
result.record.time_duration.days / std::abs(one_month_days);
// p. Set months to RoundNumberToIncrement(fractionalMonths, increment,
// roundingMode).
......@@ -9279,7 +9279,7 @@ Maybe<DurationRecordWithRemainder> RoundDuration(Isolate* isolate,
// g. Let fractionalWeeks be weeks + days / abs(oneWeekDays).
double fractional_weeks =
duration.weeks +
result.record.weeks +
result.record.time_duration.days / std::abs(one_week_days);
// h. Set weeks to RoundNumberToIncrement(fractionalWeeks, increment,
// roundingMode).
......
......@@ -454,14 +454,12 @@
# https://bugs.chromium.org/p/v8/issues/detail?id=11544
'built-ins/Temporal/Calendar/prototype/weekOfYear/calendar-datefromfields-called-with-options-undefined': [FAIL],
'built-ins/Temporal/Duration/prototype/total/relativeto-string-zoneddatetime': [FAIL],
'built-ins/Temporal/Duration/compare/relativeto-sub-minute-offset': [FAIL],
'built-ins/Temporal/Duration/prototype/add/relativeto-sub-minute-offset': [FAIL],
'built-ins/Temporal/Duration/prototype/round/relativeto-string-datetime': [FAIL],
'built-ins/Temporal/Duration/prototype/round/relativeto-sub-minute-offset': [FAIL],
'built-ins/Temporal/Duration/prototype/subtract/relativeto-sub-minute-offset': [FAIL],
'built-ins/Temporal/Duration/prototype/total/balance-negative-result': [FAIL],
'built-ins/Temporal/Duration/prototype/total/relativeto-string-plaindatetime': [FAIL],
'built-ins/Temporal/Duration/prototype/total/relativeto-sub-minute-offset': [FAIL],
'built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-multiple-offsets': [FAIL],
'built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-multiple-offsets': [FAIL],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment