Skip to content

Commit

Permalink
fix: highlight range of year in yearMode
Browse files Browse the repository at this point in the history
  • Loading branch information
KumJungMin committed Jun 14, 2024
1 parent 3326113 commit 9393704
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions packages/primevue/src/datepicker/DatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -727,17 +727,18 @@ export default {
return false;
},
isYearSelected(year) {
if (this.isComparable()) {
let value = this.isRangeSelection() ? this.modelValue[0] : this.modelValue;
if (!this.isComparable()) return false;
if (this.isMultipleSelection()) {
return value.some((currentValue) => currentValue.getFullYear() === year);
} else {
return value.getFullYear() === year;
}
}
if (this.isMultipleSelection()) {
return this.modelValue.some((currentValue) => currentValue.getFullYear() === year);
} else if (this.isRangeSelection()) {
const start = this.modelValue[0] ? this.modelValue[0].getFullYear() : null;
const end = this.modelValue[1] ? this.modelValue[1].getFullYear() : null;
return false;
return start === year || end === year || (start < year && end > year);
} else {
return value.getFullYear() === year;
}
},
isDateEquals(value, dateMeta) {
if (value) return value.getDate() === dateMeta.day && value.getMonth() === dateMeta.month && value.getFullYear() === dateMeta.year;
Expand Down

0 comments on commit 9393704

Please sign in to comment.