diff --git a/src/components/date-picker/panel/Date/date.vue b/src/components/date-picker/panel/Date/date.vue index 33360eba..917a922a 100644 --- a/src/components/date-picker/panel/Date/date.vue +++ b/src/components/date-picker/panel/Date/date.vue @@ -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; } } }, diff --git a/src/components/date-picker/picker.vue b/src/components/date-picker/picker.vue index 620c068c..0c321d9d 100644 --- a/src/components/date-picker/picker.vue +++ b/src/components/date-picker/picker.vue @@ -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]; }