Commit a781ad1a114db7b7c7bdb18f9c316d535839ba04
1 parent
65ce6ced
hide range and selections outside currentMonth
Showing
1 changed file
with
5 additions
and
4 deletions
Show diff stats
src/components/date-picker/base/date-table.vue
| ... | ... | @@ -73,14 +73,15 @@ |
| 73 | 73 | |
| 74 | 74 | return this.calendar(tableYear, tableMonth, (cell) => { |
| 75 | 75 | const time = cell.date && clearHours(cell.date); |
| 76 | + const dateIsInCurrentMonth = cell.date && tableMonth === cell.date.getMonth(); | |
| 76 | 77 | return { |
| 77 | 78 | ...cell, |
| 78 | 79 | type: time === today ? 'today' : cell.type, |
| 79 | - selected: selectedDays.includes(time), | |
| 80 | + selected: dateIsInCurrentMonth && selectedDays.includes(time), | |
| 80 | 81 | disabled: (cell.date && disabledTestFn) && disabledTestFn(new Date(time)), |
| 81 | - range: isRange && isInRange(time, rangeStart, rangeEnd), | |
| 82 | - start: isRange && time === minDay, | |
| 83 | - end: isRange && time === maxDay | |
| 82 | + range: dateIsInCurrentMonth && isRange && isInRange(time, rangeStart, rangeEnd), | |
| 83 | + start: dateIsInCurrentMonth && isRange && time === minDay, | |
| 84 | + end: dateIsInCurrentMonth && isRange && time === maxDay | |
| 84 | 85 | }; |
| 85 | 86 | }).cells.slice(this.showWeekNumbers ? 8 : 0); |
| 86 | 87 | } | ... | ... |