1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00

LibJS: Move IsValidDurationRecord check to ToDurationRecord

This is an editorial change in the Intl.DurationFormat proposal. See:
fb21723
This commit is contained in:
Timothy Flynn 2022-12-14 15:04:59 -05:00 committed by Linus Groh
parent 0086a3acdb
commit 85f079dc6b
2 changed files with 14 additions and 18 deletions

View file

@ -173,7 +173,11 @@ ThrowCompletionOr<Temporal::DurationRecord> to_duration_record(VM& vm, Value inp
if (!any)
return vm.throw_completion<TypeError>(ErrorType::TemporalInvalidDurationLikeObject);
// 6. Return result.
// 6. If IsValidDurationRecord(result) is false, throw a RangeError exception.
if (!is_valid_duration_record(result))
return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidDurationLikeObject);
// 7. Return result.
return result;
}