Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.

Commit

Permalink
Merge pull request #124 from voidst1/main
Browse files Browse the repository at this point in the history
fix: Fix reverseYears reversing months overlay (fixes #123)
  • Loading branch information
Jasenkoo authored Mar 15, 2022
2 parents 1542423 + 4b1e5fe commit ba832e9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Vue3DatePicker/components/MonthYearInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,14 @@
return props.range && props.internalModelValue && props.monthPicker ? (props.internalModelValue as Date[]) : [];
});
const getGroupedList = (items: IDefaultSelect[]): IDefaultSelect[][] => {
const getGroupedList = (items: IDefaultSelect[], reverse: Boolean = false): IDefaultSelect[][] => {
const list = [];
for (let i = 0; i < items.length; i += 3) {
const listItems = [items[i], items[i + 1], items[i + 2]];
list.push(props.reverseYears ? listItems.reverse() : listItems);
list.push(reverse ? listItems.reverse() : listItems);
}
return list;
return reverse ? list.reverse() : list;
};
const getMonthDisplayVal = computed((): IDefaultSelect => {
Expand All @@ -264,8 +264,7 @@
});
const groupedYears = computed((): IDefaultSelect[][] => {
const list = getGroupedList(props.years);
return props.reverseYears ? list.reverse() : list;
return getGroupedList(props.years, props.reverseYears);
});
const showLeftIcon = computed(() => {
Expand Down

0 comments on commit ba832e9

Please sign in to comment.