Reset panel date when dates are null
This commit is contained in:
parent
b52e02e436
commit
15457562ea
2 changed files with 10 additions and 3 deletions
|
@ -184,10 +184,16 @@
|
||||||
value(newVal) {
|
value(newVal) {
|
||||||
const minDate = newVal[0] ? toDate(newVal[0]) : null;
|
const minDate = newVal[0] ? toDate(newVal[0]) : null;
|
||||||
const maxDate = newVal[1] ? toDate(newVal[1]) : null;
|
const maxDate = newVal[1] ? toDate(newVal[1]) : null;
|
||||||
this.dates = [minDate, maxDate];
|
this.dates = [minDate, maxDate].sort();
|
||||||
|
if (JSON.stringify(this.dates) === '[null,null]') {
|
||||||
|
const leftPanelDate = this.startDate || new Date();
|
||||||
|
this.leftPanelDate = leftPanelDate,
|
||||||
|
this.rightPanelDate = new Date(leftPanelDate.getFullYear(), leftPanelDate.getMonth() + 1, leftPanelDate.getDate());
|
||||||
|
}
|
||||||
|
|
||||||
this.rangeState = {
|
this.rangeState = {
|
||||||
from: minDate,
|
from: this.dates[0],
|
||||||
to: maxDate,
|
to: this.dates[1],
|
||||||
selecting: false
|
selecting: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
@ -138,6 +138,7 @@
|
||||||
watch: {
|
watch: {
|
||||||
value (newVal) {
|
value (newVal) {
|
||||||
this.dates = newVal;
|
this.dates = newVal;
|
||||||
|
if (JSON.stringify(newVal) === '[null]') this.panelDate = this.startDate || new Date();
|
||||||
},
|
},
|
||||||
selectionMode(){
|
selectionMode(){
|
||||||
this.currentView = this.selectionMode;
|
this.currentView = this.selectionMode;
|
||||||
|
|
Loading…
Add table
Reference in a new issue