You've already forked immich
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 (#7415)
* 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:
web/src/lib/components
elements
faces-page
map-page
shared-components
24
web/src/lib/components/elements/date-input.svelte
Normal file
24
web/src/lib/components/elements/date-input.svelte
Normal file
@ -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)}
|
||||
/>
|
Reference in New Issue
Block a user