summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-11-13 14:21:08 +0000
committerLinus Groh <mail@linusgroh.de>2021-11-13 14:21:08 +0000
commitf11277b50df7b84055ce6bb022aae37b24249123 (patch)
treeb7013d3c305a2df571415b96454fa58f9532eddb /Userland/Libraries/LibJS/Runtime
parent8c73d85a65ff576d87ff102d614442745a54c704 (diff)
downloadserenity-f11277b50df7b84055ce6bb022aae37b24249123.zip
LibJS: Fix missing handling of "week" largest_unit in balance_duration()
It would crash because of VERIFY(largest_unit == "nanosecond"sv) in the final else branch when passing "week", because it's not handled in any of the previous branches.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime')
-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 0643c45dd1..034bbfc4d0 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp
@@ -381,7 +381,7 @@ ThrowCompletionOr<BalancedDuration> balance_duration(GlobalObject& global_object
result_nanoseconds = fabs(result_nanoseconds);
// 10. If largestUnit is "year", "month", "week", "day", or "hour", then
- if (largest_unit.is_one_of("year"sv, "month"sv, "day"sv, "hour"sv)) {
+ if (largest_unit.is_one_of("year"sv, "month"sv, "week"sv, "day"sv, "hour"sv)) {
// a. Set microseconds to floor(nanoseconds / 1000).
auto nanoseconds_division_result = total_nanoseconds.divided_by(Crypto::UnsignedBigInteger(1000));
// b. Set nanoseconds to nanoseconds modulo 1000.