1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-13 07:00:55 +02:00

fix(web): prevent resetting date input when entering 0 ()

* fix(web): prevent resetting date input when entering 0

* resolve conflict

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
Michel Heusschen
2024-02-27 04:07:49 +01:00
committed by GitHub
parent 99a002b947
commit 4272b496ff
5 changed files with 35 additions and 6 deletions

@ -0,0 +1,24 @@
<script lang="ts">
import type { HTMLInputAttributes } from 'svelte/elements';
interface $$Props extends HTMLInputAttributes {
type: 'date' | 'datetime-local';
}
export let value: $$Props['value'] = undefined;
$: 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:blur={() => (value = updatedValue)}
/>