mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:07:46 +00:00
LibJS: Fix fractionalSecondDigits behavior in Duration.proto.toString()
This is a normative change in the Temporal spec.
See: 3ee771e
This commit is contained in:
parent
6d5e95d621
commit
acce65b52c
1 changed files with 2 additions and 2 deletions
|
@ -1778,8 +1778,8 @@ String temporal_duration_to_string(double years, double months, double weeks, do
|
|||
time_part.append('M');
|
||||
}
|
||||
|
||||
// 21. If any of seconds, milliseconds, microseconds, and nanoseconds are not 0; or years, months, weeks, days, hours, and minutes are all 0, then
|
||||
if ((seconds != 0 || milliseconds != 0 || microseconds != 0 || nanoseconds != 0) || (years == 0 && months == 0 && weeks == 0 && days == 0 && hours == 0 && minutes == 0)) {
|
||||
// 21. If any of seconds, milliseconds, microseconds, and nanoseconds are not 0; or years, months, weeks, days, hours, and minutes are all 0; or precision is not "auto"; then
|
||||
if ((seconds != 0 || milliseconds != 0 || microseconds != 0 || nanoseconds != 0) || (years == 0 && months == 0 && weeks == 0 && days == 0 && hours == 0 && minutes == 0) || (precision.has<StringView>() && precision.get<StringView>() != "auto"sv)) {
|
||||
// a. Let fraction be abs(milliseconds) × 10^6 + abs(microseconds) × 10^3 + abs(nanoseconds).
|
||||
auto fraction = fabs(milliseconds) * 1'000'000 + fabs(microseconds) * 1'000 + fabs(nanoseconds);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue