summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-04-12 22:20:33 +0100
committerLinus Groh <mail@linusgroh.de>2022-04-12 23:43:29 +0100
commit5397278bfcdc0f906b2b514cae1ffddbf34a115a (patch)
tree9b6f4733e99408f5b56114da497926f67dbbb723 /Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp
parent431a9938a8ecdd01dea4a60a3f8ec62ddb3d9419 (diff)
downloadserenity-5397278bfcdc0f906b2b514cae1ffddbf34a115a.zip
LibJS: Update spec comments to use ToZeroPaddedDecimalString AO
This is an editorial change in the ECMA-262 and Temporal specs. See: - https://github.com/tc39/ecma262/commit/843d8b8 - https://github.com/tc39/proposal-temporal/commit/f9211d9 Note that we don't actually need to implement the AO as we already have String::formatted() for this, and use unified format strings instead of zero-padding in individual steps in many cases anyway.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp
index 370f690747..c698c09e65 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp
@@ -1661,7 +1661,7 @@ String temporal_duration_to_string(double years, double months, double weeks, do
// 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);
- // b. Let decimalPart be fraction formatted as a nine-digit decimal number, padded to the left with zeroes if necessary.
+ // b. Let decimalPart be ToZeroPaddedDecimalString(fraction, 9).
// NOTE: padding with zeros leads to weird results when applied to a double. Not sure if that's a bug in AK/Format.h or if I'm doing this wrong.
auto decimal_part = String::formatted("{:09}", (u64)fraction);