fix: highlight range of year in yearMode

pull/5884/head
KumJungMin 2024-06-14 14:28:04 +09:00
parent 3326113305
commit 93937046a8
1 changed files with 10 additions and 9 deletions

View File

@ -727,17 +727,18 @@ export default {
return false; return false;
}, },
isYearSelected(year) { isYearSelected(year) {
if (this.isComparable()) { if (!this.isComparable()) return false;
let value = this.isRangeSelection() ? this.modelValue[0] : this.modelValue;
if (this.isMultipleSelection()) { if (this.isMultipleSelection()) {
return value.some((currentValue) => currentValue.getFullYear() === year); return this.modelValue.some((currentValue) => currentValue.getFullYear() === year);
} else { } else if (this.isRangeSelection()) {
return value.getFullYear() === year; const start = this.modelValue[0] ? this.modelValue[0].getFullYear() : null;
} const end = this.modelValue[1] ? this.modelValue[1].getFullYear() : null;
return start === year || end === year || (start < year && end > year);
} else {
return value.getFullYear() === year;
} }
return false;
}, },
isDateEquals(value, dateMeta) { isDateEquals(value, dateMeta) {
if (value) return value.getDate() === dateMeta.day && value.getMonth() === dateMeta.month && value.getFullYear() === dateMeta.year; if (value) return value.getDate() === dateMeta.day && value.getMonth() === dateMeta.month && value.getFullYear() === dateMeta.year;