fix: flatpickr date not updating (#1336)

Fixes https://github.com/go-vikunja/api/issues/16

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/1336
Co-authored-by: konrad <k@knt.li>
Co-committed-by: konrad <k@knt.li>
This commit is contained in:
konrad 2022-01-09 10:17:18 +00:00
parent ed88fb91bc
commit 6080e49f26

View file

@ -128,10 +128,6 @@ export default {
date: null, date: null,
show: false, show: false,
changed: false, changed: false,
// Since flatpickr dates are strings, we need to convert them to native date objects.
// To make that work, we need a separate variable since flatpickr does not have a change event.
flatPickrDate: null,
} }
}, },
components: { components: {
@ -164,10 +160,6 @@ export default {
handler: 'setDateValue', handler: 'setDateValue',
immediate: true, immediate: true,
}, },
flatPickrDate(newVal) {
this.date = createDateFromString(newVal)
this.updateData()
},
}, },
computed: { computed: {
flatPickerConfig() { flatPickerConfig() {
@ -183,6 +175,17 @@ export default {
}, },
} }
}, },
// Since flatpickr dates are strings, we need to convert them to native date objects.
// To make that work, we need a separate variable since flatpickr does not have a change event.
flatPickrDate: {
set(newValue) {
this.date = createDateFromString(newValue)
this.updateData()
},
get() {
return format(this.date, 'yyy-LL-dd H:mm')
},
},
}, },
methods: { methods: {
setDateValue(newVal) { setDateValue(newVal) {