Commit 88d24200e8e74f0bcf453a97701c5e691dffa822
1 parent
abb0cc87
Fix date toggle in "multiple mode"
Showing
1 changed file
with
3 additions
and
1 deletions
Show diff stats
src/components/date-picker/picker.vue
... | ... | @@ -356,8 +356,10 @@ |
356 | 356 | }, |
357 | 357 | onPick(dates, visible = false) { |
358 | 358 | if (this.multiple){ |
359 | + const pickedTimeStamp = dates.getTime(); | |
360 | + const indexOfPickedDate = this.internalValue.findIndex(date => date && date.getTime() === pickedTimeStamp); | |
359 | 361 | const allDates = [...this.internalValue, dates].filter(Boolean); |
360 | - const timeStamps = allDates.map(date => date.getTime()).filter((ts, i, arr) => arr.indexOf(ts) === i); // filter away duplicates | |
362 | + const timeStamps = allDates.map(date => date.getTime()).filter((ts, i, arr) => arr.indexOf(ts) === i && i !== indexOfPickedDate); // filter away duplicates | |
361 | 363 | this.internalValue = timeStamps.map(ts => new Date(ts)); |
362 | 364 | } else { |
363 | 365 | this.internalValue = Array.isArray(dates) ? dates : [dates]; | ... | ... |