mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 10:17:34 +00:00
LibJS: Disallow one day long time zone offsets
This is a normative change in the Temporal spec.
See: 9cc8b29b
This commit is contained in:
parent
1167fdb17a
commit
1b0ca52c54
7 changed files with 83 additions and 10 deletions
|
@ -246,7 +246,8 @@
|
|||
M(TemporalInvalidMonthCode, "Invalid month code") \
|
||||
M(TemporalInvalidMonthDayString, "Invalid month day string '{}'") \
|
||||
M(TemporalInvalidMonthDayStringUTCDesignator, "Invalid month day string '{}': must not contain a UTC designator") \
|
||||
M(TemporalInvalidOffsetNanosecondsValue, "Invalid offset nanoseconds value, must be in range -86400 * 10^9 to 86400 * 10^9") \
|
||||
M(TemporalInvalidOffsetNanosecondsValue, "Invalid offset nanoseconds value, must be in range -86400 * 10^9 + 1 to " \
|
||||
"86400 * 10^9 - 1") \
|
||||
M(TemporalInvalidPlainDate, "Invalid plain date") \
|
||||
M(TemporalInvalidPlainDateTime, "Invalid plain date time") \
|
||||
M(TemporalInvalidPlainMonthDay, "Invalid plain month day") \
|
||||
|
|
|
@ -492,8 +492,8 @@ ThrowCompletionOr<double> get_offset_nanoseconds_for(VM& vm, Value time_zone, In
|
|||
// 5. Set offsetNanoseconds to ℝ(offsetNanoseconds).
|
||||
auto offset_nanoseconds = offset_nanoseconds_value.as_double();
|
||||
|
||||
// 6. If abs(offsetNanoseconds) > nsPerDay, throw a RangeError exception.
|
||||
if (fabs(offset_nanoseconds) > ns_per_day)
|
||||
// 6. If abs(offsetNanoseconds) ≥ nsPerDay, throw a RangeError exception.
|
||||
if (fabs(offset_nanoseconds) >= ns_per_day)
|
||||
return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidOffsetNanosecondsValue);
|
||||
|
||||
// 7. Return offsetNanoseconds.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue