mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:47:35 +00:00
LibJS: Fix parse ErrorType used in parse_temporal_date_string()
TemporalInvalidDateString, not TemporalInvalidDateTimeString.
This commit is contained in:
parent
b6f49924be
commit
836ce8ee5d
2 changed files with 7 additions and 1 deletions
|
@ -1269,7 +1269,7 @@ ThrowCompletionOr<TemporalDate> parse_temporal_date_string(GlobalObject& global_
|
|||
auto parse_result = parse_iso8601(Production::TemporalDateString, iso_string);
|
||||
if (!parse_result.has_value()) {
|
||||
// a. Throw a RangeError exception.
|
||||
return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidDateTimeString, iso_string);
|
||||
return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidDateString, iso_string);
|
||||
}
|
||||
|
||||
// 3. Let result be ? ParseISODateTime(isoString).
|
||||
|
|
|
@ -43,4 +43,10 @@ describe("errors", () => {
|
|||
Temporal.PlainDate.from(zonedDateTime);
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
});
|
||||
|
||||
test("invalid date string", () => {
|
||||
expect(() => {
|
||||
Temporal.PlainDate.from("foo");
|
||||
}).toThrowWithMessage(RangeError, "Invalid date string 'foo'");
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue