LibJS: Verify valid Duraton is made in DifferenceTemporalPlainDate

It shouldn't be possible to create an invalid duration here, so follow
the spec and verify that this succeeds.
This commit is contained in:
Shannon Booth 2024-02-16 21:11:57 +13:00 committed by Tim Flynn
parent bb8dad5bb0
commit 4348b484c6
Notes: sideshowbarker 2024-07-17 02:06:40 +09:00

View File

@ -577,7 +577,7 @@ ThrowCompletionOr<NonnullGCPtr<Duration>> difference_temporal_plain_date(VM& vm,
}
// 16. Return ! CreateTemporalDuration(sign × result.[[Years]], sign × result.[[Months]], sign × result.[[Weeks]], sign × result.[[Days]], 0, 0, 0, 0, 0, 0).
return TRY(create_temporal_duration(vm, sign * result->years(), sign * result->months(), sign * result->weeks(), sign * result->days(), 0, 0, 0, 0, 0, 0));
return MUST(create_temporal_duration(vm, sign * result->years(), sign * result->months(), sign * result->weeks(), sign * result->days(), 0, 0, 0, 0, 0, 0));
}
}