浏览代码

LibJS: Use nsMinInstant / nsMaxInstant constants in ParseTemporalInstant

This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/a045682
Linus Groh 3 年之前
父节点
当前提交
287dd03e2e
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp

+ 1 - 1
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]]).
     // 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);
     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) < nsMinInstant or ℝ(utc) > nsMaxInstant, then
     if (utc->big_integer() < ns_min_instant || utc->big_integer() > ns_max_instant) {
     if (utc->big_integer() < ns_min_instant || utc->big_integer() > ns_max_instant) {
         // a. Throw a RangeError exception.
         // a. Throw a RangeError exception.
         return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidEpochNanoseconds);
         return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidEpochNanoseconds);