diff options
author | Linus Groh <mail@linusgroh.de> | 2022-06-23 19:38:38 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-06-24 22:12:03 +0100 |
commit | 34f02bed176978fff5d5f26f72e2b32d97b30dfc (patch) | |
tree | 4e403daba7d8284123bcbf7d456c08a99e9f559a | |
parent | 9c31fee4b5658d8f3deb50997016aee1fee71419 (diff) | |
download | serenity-34f02bed176978fff5d5f26f72e2b32d97b30dfc.zip |
LibJS: Remove check for Instant range before subtracting UTC offset
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/5e2fecb
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp index 190e4b9e90..212acc1f97 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp @@ -118,25 +118,19 @@ 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) < nsMinInstant or ℝ(utc) > nsMaxInstant, then - if (utc->big_integer() < ns_min_instant || utc->big_integer() > ns_max_instant) { - // a. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidEpochNanoseconds); - } - - // 7. Let offsetNanoseconds be ? ParseTimeZoneOffsetString(offsetString). + // 6. Let offsetNanoseconds be ? ParseTimeZoneOffsetString(offsetString). auto offset_nanoseconds = TRY(parse_time_zone_offset_string(global_object, *offset_string)); - // 8. Let result be utc - ℤ(offsetNanoseconds). + // 7. 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 + // 8. 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); } - // 10. Return result. + // 9. Return result. return result_ns; } |