Commit ba3ad889e451442fd164a6b607800ac0e7fc342f

Authored by SergioCrisostomo
1 parent 6f816027

Use last selected date in date panel navigation

Showing 1 changed file with 3 additions and 2 deletions   Show diff stats
src/components/date-picker/panel/Date/date.vue
... ... @@ -150,7 +150,8 @@
150 150 watch: {
151 151 value (newVal) {
152 152 this.dates = newVal;
153   - this.panelDate = this.startDate || (this.multiple ? this.dates[this.dates.length - 1] : this.dates[0]) || new Date();
  153 + const panelDate = this.multiple ? this.dates[this.dates.length - 1] : (this.startDate || this.dates[0]);
  154 + this.panelDate = panelDate || new Date();
154 155 },
155 156 currentView (currentView) {
156 157 this.$emit('on-selection-mode-change', currentView);
... ... @@ -170,7 +171,7 @@
170 171 const isDifferentYear = date.getFullYear() !== this.panelDate.getFullYear();
171 172 const isDifferentMonth = isDifferentYear || date.getMonth() !== this.panelDate.getMonth();
172 173 if (isDifferentYear || isDifferentMonth){
173   - this.panelDate = date;
  174 + if (!this.multiple) this.panelDate = date;
174 175 }
175 176 }
176 177 },
... ...