mirror of
https://github.com/immich-app/immich
synced 2025-06-08 04:22:20 +00:00

* fix(web): prevent resetting date input when entering 0 * resolve conflict --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
25 lines
550 B
Svelte
25 lines
550 B
Svelte
<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)}
|
|
/>
|