Make flatpickr dates work
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
kolaente 2020-11-28 12:53:25 +01:00
parent 33b9160a24
commit 85ce39eca0
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 8 additions and 1 deletions

View File

@ -94,7 +94,7 @@
<flat-pickr <flat-pickr
:config="flatPickerConfig" :config="flatPickerConfig"
class="input" class="input"
v-model="date" v-model="flatPickrDate"
/> />
</div> </div>
</transition> </transition>
@ -124,6 +124,9 @@ export default {
time_24hr: true, time_24hr: true,
inline: true, inline: true,
}, },
// 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: {
@ -149,6 +152,10 @@ export default {
value(newVal) { value(newVal) {
this.date = newVal this.date = newVal
}, },
flatPickrDate(newVal) {
this.date = new Date(newVal)
this.updateData()
},
}, },
methods: { methods: {
updateData() { updateData() {