diff options
author | Linus Groh <mail@linusgroh.de> | 2022-04-29 19:10:21 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-04-29 22:40:46 +0200 |
commit | 76a6bd0e757303840f7715afc5e7dba290cfa365 (patch) | |
tree | a09de5363f04a108731072842ace200d04c55cb6 /Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp | |
parent | 70593b744835ffb880053dbb422fd1c576be00b6 (diff) | |
download | serenity-76a6bd0e757303840f7715afc5e7dba290cfa365.zip |
LibJS: Fix numeric type confusion in GetEpochFromISOParts return value
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/2a59eac
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp index 6c13c6cf80..6c934e4c7d 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp @@ -118,7 +118,7 @@ ThrowCompletionOr<BigInt*> parse_temporal_instant(GlobalObject& global_object, S // 5. Let utc be GetEpochFromISOParts(result.[[Year]], result.[[Month]], result.[[Day]], result.[[Hour]], result.[[Minute]], result.[[Second]], result.[[Millisecond]], result.[[Microsecond]], result.[[Nanosecond]]). auto* utc = get_epoch_from_iso_parts(global_object, result.year, result.month, result.day, result.hour, result.minute, result.second, result.millisecond, result.microsecond, result.nanosecond); - // 6. If utc < −8.64 × 10^21 or utc > 8.64 × 10^21, then + // 6. If ℝ(utc) < −8.64 × 10^21 or ℝ(utc) > 8.64 × 10^21, then if (utc->big_integer() < INSTANT_NANOSECONDS_MIN || utc->big_integer() > INSTANT_NANOSECONDS_MAX) { // a. Throw a RangeError exception. return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidEpochNanoseconds); @@ -127,10 +127,10 @@ ThrowCompletionOr<BigInt*> parse_temporal_instant(GlobalObject& global_object, S // 7. Let offsetNanoseconds be ? ParseTimeZoneOffsetString(offsetString). auto offset_nanoseconds = TRY(parse_time_zone_offset_string(global_object, *offset_string)); - // 8. Let result be utc − offsetNanoseconds. + // 8. Let result be utc − ℤ(offsetNanoseconds). auto* result_ns = js_bigint(vm, utc->big_integer().minus(Crypto::SignedBigInteger::create_from(offset_nanoseconds))); - // 9. If ! IsValidEpochNanoseconds(ℤ(result)) is false, then + // 9. If ! IsValidEpochNanoseconds(result) is false, then if (!is_valid_epoch_nanoseconds(*result_ns)) { // a. Throw a RangeError exception. return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidEpochNanoseconds); |