fix(components): handle null values in DatepickerWithValues

- Add null to date ref type to match props.modelValue type
- Convert Date to string before passing to parseDateOrString
- Add null coalescing for flatpickrDate assignment
This commit is contained in:
kolaente
2025-11-22 15:58:28 +01:00
parent 8e089f5789
commit a575159424
2 changed files with 5 additions and 3 deletions

View File

@@ -121,7 +121,7 @@ const showHowItWorks = ref(false)
const flatpickrDate = ref('')
const date = ref<string|Date>('')
const date = ref<string|Date|null>('')
watch(
() => props.modelValue,
@@ -129,9 +129,10 @@ watch(
date.value = newValue
// Only set the date back to flatpickr when it's an actual date.
// Otherwise flatpickr runs in an endless loop and slows down the browser.
const parsed = parseDateOrString(date.value, false)
const dateValueAsString = date.value instanceof Date ? date.value.toISOString() : date.value
const parsed = parseDateOrString(dateValueAsString, false)
if (parsed instanceof Date) {
flatpickrDate.value = date.value
flatpickrDate.value = date.value instanceof Date ? date.value.toISOString() : (date.value ?? '')
}
},
)

View File

@@ -26,6 +26,7 @@ const PREFIXED_SCSS_STYLES = `@use "sass:math";
/*
** Configure sentry plugin
*/
// @ts-ignore
function getSentryConfig(env: ImportMetaEnv): ViteSentryPluginOptions {
return {
skipEnvironmentCheck: true,