1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:27:35 +00:00

LibJS: Fix logic typo in round_duration() remainder calculation

For unit == "hour", the remainder would not return the difference
between fractional_hours and hours, but fractional_hours and days.
This commit is contained in:
Linus Groh 2021-11-13 13:29:07 +00:00
parent f0cd727d74
commit 8c73d85a65

View file

@ -1048,7 +1048,7 @@ ThrowCompletionOr<RoundedDuration> round_duration(GlobalObject& global_object, d
hours = (double)round_number_to_increment(fractional_hours, increment, rounding_mode);
// c. Set remainder to fractionalHours - hours.
remainder = fractional_hours - days;
remainder = fractional_hours - hours;
// d. Set minutes, seconds, milliseconds, microseconds, and nanoseconds to 0.
minutes = 0;