mirror of
https://github.com/go-vikunja/vikunja.git
synced 2025-12-05 18:57:47 -06:00
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:
@@ -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 ?? '')
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
@@ -26,6 +26,7 @@ const PREFIXED_SCSS_STYLES = `@use "sass:math";
|
||||
/*
|
||||
** Configure sentry plugin
|
||||
*/
|
||||
// @ts-ignore
|
||||
function getSentryConfig(env: ImportMetaEnv): ViteSentryPluginOptions {
|
||||
return {
|
||||
skipEnvironmentCheck: true,
|
||||
|
||||
Reference in New Issue
Block a user