From 4272b496ff48f30d20d163725082d77622579dd6 Mon Sep 17 00:00:00 2001 From: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> Date: Tue, 27 Feb 2024 04:07:49 +0100 Subject: [PATCH] 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 --- .../lib/components/elements/date-input.svelte | 24 +++++++++++++++++++ .../faces-page/set-birth-date-modal.svelte | 3 ++- .../map-page/map-settings-modal.svelte | 5 ++-- .../shared-components/change-date.svelte | 3 ++- .../search-bar/search-date-section.svelte | 6 +++-- 5 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 web/src/lib/components/elements/date-input.svelte diff --git a/web/src/lib/components/elements/date-input.svelte b/web/src/lib/components/elements/date-input.svelte new file mode 100644 index 0000000000..e4ec4bcab8 --- /dev/null +++ b/web/src/lib/components/elements/date-input.svelte @@ -0,0 +1,24 @@ + + + { + updatedValue = e.currentTarget.value; + + // Only update when value is not empty to prevent resetting the input + if (updatedValue !== '') { + value = updatedValue; + } + }} + on:blur={() => (value = updatedValue)} +/> diff --git a/web/src/lib/components/faces-page/set-birth-date-modal.svelte b/web/src/lib/components/faces-page/set-birth-date-modal.svelte index 415f5c0f76..717b88d031 100644 --- a/web/src/lib/components/faces-page/set-birth-date-modal.svelte +++ b/web/src/lib/components/faces-page/set-birth-date-modal.svelte @@ -4,6 +4,7 @@ import FullScreenModal from '../shared-components/full-screen-modal.svelte'; import { mdiCake } from '@mdi/js'; import Icon from '$lib/components/elements/icon.svelte'; + import DateInput from '../elements/date-input.svelte'; export let birthDate: string; @@ -37,7 +38,7 @@
handleSubmit()} autocomplete="off">
-
-
- +
-