mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:27:45 +00:00
LibJS: Use the rounding abstract operations from Intl.NumberFormat V3
This is an editorial change in the Temporal spec.
See: 75279e5
Co-Authored-By: Idan Horowitz <idan.horowitz@gmail.com>
This commit is contained in:
parent
93a20b3bfb
commit
ae1fdf299d
7 changed files with 306 additions and 113 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue