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,14 +73,15 @@ | ||
| 73 | 73 | ||
| 74 | return this.calendar(tableYear, tableMonth, (cell) => { | 74 | return this.calendar(tableYear, tableMonth, (cell) => { |
| 75 | const time = cell.date && clearHours(cell.date); | 75 | const time = cell.date && clearHours(cell.date); |
| 76 | + const dateIsInCurrentMonth = cell.date && tableMonth === cell.date.getMonth(); | ||
| 76 | return { | 77 | return { |
| 77 | ...cell, | 78 | ...cell, |
| 78 | type: time === today ? 'today' : cell.type, | 79 | type: time === today ? 'today' : cell.type, |
| 79 | - selected: selectedDays.includes(time), | 80 | + selected: dateIsInCurrentMonth && selectedDays.includes(time), |
| 80 | disabled: (cell.date && disabledTestFn) && disabledTestFn(new Date(time)), | 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 | }).cells.slice(this.showWeekNumbers ? 8 : 0); | 86 | }).cells.slice(this.showWeekNumbers ? 8 : 0); |
| 86 | } | 87 | } |