fix(web): date input on chrome (#7669)

This commit is contained in:
Michel Heusschen 2024-03-06 12:47:15 +01:00 committed by GitHub
parent 9125999d1a
commit 52a52f9f40
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,19 +6,15 @@
}
export let value: $$Props['value'] = undefined;
// Updating `value` directly causes the date input to reset itself or
// interfere with user changes.
$: updatedValue = value;
</script>
<input
{...$$restProps}
{value}
on:input={(e) => {
updatedValue = e.currentTarget.value;
// Only update when value is not empty to prevent resetting the input
if (updatedValue !== '') {
value = updatedValue;
}
}}
on:input={(e) => (updatedValue = e.currentTarget.value)}
on:blur={() => (value = updatedValue)}
/>