|
@@ -1346,16 +1346,21 @@ ThrowCompletionOr<TemporalZonedDateTime> parse_temporal_relative_to_string(Globa
|
|
|
}
|
|
|
|
|
|
// 13.43 ParseTemporalTimeString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaltimestring
|
|
|
-ThrowCompletionOr<TemporalTime> parse_temporal_time_string(GlobalObject& global_object, [[maybe_unused]] String const& iso_string)
|
|
|
+ThrowCompletionOr<TemporalTime> parse_temporal_time_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 TemporalTimeString (see 13.33), then
|
|
|
- // a. Throw a RangeError exception.
|
|
|
- // TODO
|
|
|
+ auto parse_result = parse_iso8601(Production::TemporalTimeString, iso_string);
|
|
|
+ if (!parse_result.has_value()) {
|
|
|
+ // a. Throw a RangeError exception.
|
|
|
+ return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidTimeString, 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 { [[Hour]]: result.[[Hour]], [[Minute]]: result.[[Minute]], [[Second]]: result.[[Second]], [[Millisecond]]: result.[[Millisecond]], [[Microsecond]]: result.[[Microsecond]], [[Nanosecond]]: result.[[Nanosecond]], [[Calendar]]: result.[[Calendar]] }.
|
|
|
return TemporalTime { .hour = result.hour, .minute = result.minute, .second = result.second, .millisecond = result.millisecond, .microsecond = result.microsecond, .nanosecond = result.nanosecond, .calendar = move(result.calendar) };
|