fix: reset the flatpickr range when setting a date either manually or through a quick setting

This commit is contained in:
kolaente 2022-01-09 14:11:28 +01:00
parent fd4eec4769
commit c04530c540
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 9 additions and 4 deletions

View File

@ -25,7 +25,7 @@
{{ $t('input.datepickerRange.from') }}
<div class="field has-addons">
<div class="control is-fullwidth">
<input class="input" type="text" v-model="from" @change="emitChanged"/>
<input class="input" type="text" v-model="from" @change="inputChanged"/>
</div>
<div class="control">
<x-button icon="calendar" variant="secondary" data-toggle/>
@ -36,7 +36,7 @@
{{ $t('input.datepickerRange.to') }}
<div class="field has-addons">
<div class="control is-fullwidth">
<input class="input" type="text" v-model="to" @change="emitChanged"/>
<input class="input" type="text" v-model="to" @change="inputChanged"/>
</div>
<div class="control">
<x-button icon="calendar" variant="secondary" data-toggle/>
@ -93,6 +93,11 @@ function emitChanged() {
})
}
function inputChanged() {
flatpickrRange.value = ''
emitChanged()
}
watch(
() => flatpickrRange.value,
(newVal: string | null) => {
@ -117,7 +122,7 @@ function setDateRange(range: string[] | null) {
if (range === null) {
from.value = ''
to.value = ''
emitChanged()
inputChanged()
return
}
@ -125,7 +130,7 @@ function setDateRange(range: string[] | null) {
from.value = range[0]
to.value = range[1]
emitChanged()
inputChanged()
}
const dateRanges = {