summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-05-24 18:26:13 +0100
committerLinus Groh <mail@linusgroh.de>2022-05-25 00:25:23 +0100
commitae1fdf299d8c92062ad53a71f614d68ce37ee1d8 (patch)
treed4da8d4a382166dbad3313ad3c09040d613402b9 /Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp
parent93a20b3bfb23e122eccf817b733625d8599b6614 (diff)
downloadserenity-ae1fdf299d8c92062ad53a71f614d68ce37ee1d8.zip
LibJS: Use the rounding abstract operations from Intl.NumberFormat V3
This is an editorial change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/75279e5 Co-Authored-By: Idan Horowitz <idan.horowitz@gmail.com>
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp
index 4e3f5a2ba1..008026ea98 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp
@@ -196,6 +196,8 @@ BigInt* difference_instant(GlobalObject& global_object, BigInt const& nanosecond
// 8.5.8 RoundTemporalInstant ( ns, increment, unit, roundingMode ), https://tc39.es/proposal-temporal/#sec-temporal-roundtemporalinstant
BigInt* round_temporal_instant(GlobalObject& global_object, BigInt const& nanoseconds, u64 increment, StringView unit, StringView rounding_mode)
{
+ auto& vm = global_object.vm();
+
// 1. Assert: Type(ns) is BigInt.
u64 increment_nanoseconds;
@@ -233,8 +235,8 @@ BigInt* round_temporal_instant(GlobalObject& global_object, BigInt const& nanose
increment_nanoseconds = increment;
}
- // 8. Return ! RoundNumberToIncrement(ℝ(ns), incrementNs, roundingMode).
- return round_number_to_increment(global_object, nanoseconds, increment_nanoseconds, rounding_mode);
+ // 8. Return RoundNumberToIncrement(ℝ(ns), incrementNs, roundingMode).
+ return js_bigint(vm, round_number_to_increment(nanoseconds.big_integer(), increment_nanoseconds, rounding_mode));
}
// 8.5.9 TemporalInstantToString ( instant, timeZone, precision ), https://tc39.es/proposal-temporal/#sec-temporal-temporalinstanttostring