Files
immich/web/src/lib/components/elements/date-input.svelte

21 lines
508 B
Svelte
Raw Normal View History

<script lang="ts">
import type { HTMLInputAttributes } from 'svelte/elements';
interface $$Props extends HTMLInputAttributes {
type: 'date' | 'datetime-local';
}
export let value: $$Props['value'] = undefined;
2024-03-06 12:47:15 +01:00
// Updating `value` directly causes the date input to reset itself or
// interfere with user changes.
$: updatedValue = value;
</script>
<input
{...$$restProps}
{value}
2024-03-06 12:47:15 +01:00
on:input={(e) => (updatedValue = e.currentTarget.value)}
on:blur={() => (value = updatedValue)}
/>