|
@@ -1240,16 +1240,21 @@ ThrowCompletionOr<String> parse_temporal_calendar_string(GlobalObject& global_ob
|
|
|
}
|
|
|
|
|
|
// 13.38 ParseTemporalDateString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaldatestring
|
|
|
-ThrowCompletionOr<TemporalDate> parse_temporal_date_string(GlobalObject& global_object, [[maybe_unused]] String const& iso_string)
|
|
|
+ThrowCompletionOr<TemporalDate> parse_temporal_date_string(GlobalObject& global_object, String const& iso_string)
|
|
|
{
|
|
|
+ auto& vm = global_object.vm();
|
|
|
+
|
|
|
// 1. Assert: Type(isoString) is String.
|
|
|
|
|
|
// 2. If isoString does not satisfy the syntax of a TemporalDateString (see 13.33), then
|
|
|
- // a. Throw a RangeError exception.
|
|
|
- // TODO
|
|
|
+ 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);
|
|
|
+ }
|
|
|
|
|
|
// 3. Let result be ? ParseISODateTime(isoString).
|
|
|
- auto result = TRY(parse_iso_date_time(global_object, {}));
|
|
|
+ auto result = TRY(parse_iso_date_time(global_object, *parse_result));
|
|
|
|
|
|
// 4. Return the Record { [[Year]]: result.[[Year]], [[Month]]: result.[[Month]], [[Day]]: result.[[Day]], [[Calendar]]: result.[[Calendar]] }.
|
|
|
return TemporalDate { .year = result.year, .month = result.month, .day = result.day, .calendar = move(result.calendar) };
|