mirror of https://github.com/immich-app/immich.git
fix(web): prevent resetting date input when entering 0 (#7415)
* fix(web): prevent resetting date input when entering 0 * resolve conflict --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>pull/7383/head^2
parent
99a002b947
commit
4272b496ff
@ -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)}
|
||||
/>
|
||||
Loading…
Reference in New Issue