Merge pull request #4256 from SergioCrisostomo/fix-4249
Use last selected multiple date in date panel navigation
This commit is contained in:
commit
bc39c5c1d7
2 changed files with 4 additions and 3 deletions
|
@ -150,7 +150,8 @@
|
|||
watch: {
|
||||
value (newVal) {
|
||||
this.dates = newVal;
|
||||
this.panelDate = this.startDate || (this.multiple ? this.dates[this.dates.length - 1] : this.dates[0]) || new Date();
|
||||
const panelDate = this.multiple ? this.dates[this.dates.length - 1] : (this.startDate || this.dates[0]);
|
||||
this.panelDate = panelDate || new Date();
|
||||
},
|
||||
currentView (currentView) {
|
||||
this.$emit('on-selection-mode-change', currentView);
|
||||
|
@ -170,7 +171,7 @@
|
|||
const isDifferentYear = date.getFullYear() !== this.panelDate.getFullYear();
|
||||
const isDifferentMonth = isDifferentYear || date.getMonth() !== this.panelDate.getMonth();
|
||||
if (isDifferentYear || isDifferentMonth){
|
||||
this.panelDate = date;
|
||||
if (!this.multiple) this.panelDate = date;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -646,7 +646,6 @@
|
|||
}
|
||||
},
|
||||
onPick(dates, visible = false, type) {
|
||||
dates = this.parseDate(dates);
|
||||
if (this.multiple){
|
||||
const pickedTimeStamp = dates.getTime();
|
||||
const indexOfPickedDate = this.internalValue.findIndex(date => date && date.getTime() === pickedTimeStamp);
|
||||
|
@ -654,6 +653,7 @@
|
|||
const timeStamps = allDates.map(date => date.getTime()).filter((ts, i, arr) => arr.indexOf(ts) === i && i !== indexOfPickedDate); // filter away duplicates
|
||||
this.internalValue = timeStamps.map(ts => new Date(ts));
|
||||
} else {
|
||||
dates = this.parseDate(dates);
|
||||
this.internalValue = Array.isArray(dates) ? dates : [dates];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue