From 52a52f9f4006ccf013d050be4e981d4f048708d8 Mon Sep 17 00:00:00 2001 From: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> Date: Wed, 6 Mar 2024 12:47:15 +0100 Subject: [PATCH] fix(web): date input on chrome (#7669) --- web/src/lib/components/elements/date-input.svelte | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/web/src/lib/components/elements/date-input.svelte b/web/src/lib/components/elements/date-input.svelte index e4ec4bcab8..1f621b2464 100644 --- a/web/src/lib/components/elements/date-input.svelte +++ b/web/src/lib/components/elements/date-input.svelte @@ -6,19 +6,15 @@ } export let value: $$Props['value'] = undefined; + + // Updating `value` directly causes the date input to reset itself or + // interfere with user changes. $: updatedValue = value; { - updatedValue = e.currentTarget.value; - - // Only update when value is not empty to prevent resetting the input - if (updatedValue !== '') { - value = updatedValue; - } - }} + on:input={(e) => (updatedValue = e.currentTarget.value)} on:blur={() => (value = updatedValue)} />