summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp
index 4248f74ef8..74be2f637e 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp
@@ -136,13 +136,16 @@ ISODateTime get_iso_parts_from_epoch(GlobalObject& global_object, Crypto::Signed
// 10. Let millisecond be ℝ(! msFromTime(epochMilliseconds)).
auto millisecond = ms_from_time(epoch_milliseconds);
- // 11. Let microsecond be floor(remainderNs / 1000) modulo 1000.
- auto microsecond = modulo(floor(remainder_ns / 1000), 1000);
+ // 11. Let microsecond be floor(remainderNs / 1000).
+ auto microsecond = floor(remainder_ns / 1000);
- // 12. Let nanosecond be remainderNs modulo 1000.
+ // 12. Assert: microsecond < 1000.
+ VERIFY(microsecond < 1000);
+
+ // 13. Let nanosecond be remainderNs modulo 1000.
auto nanosecond = modulo(remainder_ns, 1000);
- // 13. Return the Record { [[Year]]: year, [[Month]]: month, [[Day]]: day, [[Hour]]: hour, [[Minute]]: minute, [[Second]]: second, [[Millisecond]]: millisecond, [[Microsecond]]: microsecond, [[Nanosecond]]: nanosecond }.
+ // 14. Return the Record { [[Year]]: year, [[Month]]: month, [[Day]]: day, [[Hour]]: hour, [[Minute]]: minute, [[Second]]: second, [[Millisecond]]: millisecond, [[Microsecond]]: microsecond, [[Nanosecond]]: nanosecond }.
return { .year = year, .month = month, .day = day, .hour = hour, .minute = minute, .second = second, .millisecond = millisecond, .microsecond = static_cast<u16>(microsecond), .nanosecond = static_cast<u16>(nanosecond) };
}