Calendar: Months are not highlighted with selection-mode="multiple" (#3989)
* Fix Calendar month selection * fix: highlight for selection mode onlypull/4452/head
parent
3d5e1cd1db
commit
5c727bb7a7
|
@ -435,13 +435,27 @@ export default {
|
|||
},
|
||||
isMonthSelected(month) {
|
||||
if (this.isComparable()) {
|
||||
if (this.view !== 'month') {
|
||||
return false;
|
||||
}
|
||||
|
||||
let value = this.isRangeSelection() ? this.value[0] : this.value;
|
||||
return !this.isMultipleSelection() ? (value.getMonth() === month && value.getFullYear() === this.currentYear) : false;
|
||||
const isMonthSelected = (valueDate) => valueDate.getMonth() === month && valueDate.getFullYear() === this.currentYear;
|
||||
|
||||
if (this.isMultipleSelection()) {
|
||||
return value.some(isMonthSelected);
|
||||
}
|
||||
return isMonthSelected(value);
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
isYearSelected(year) {
|
||||
if (this.isComparable()) {
|
||||
if (this.view !== 'year') {
|
||||
return false;
|
||||
}
|
||||
|
||||
let value = this.isRangeSelection() ? this.value[0] : this.value;
|
||||
return !this.isMultipleSelection() && this.isComparable() ? (value.getFullYear() === year) : false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue