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

Commit

Permalink
fix: Fixed reverseYears reversing months overlay (fixes #123)
Browse files Browse the repository at this point in the history
  • Loading branch information
voidst1 committed Mar 15, 2022
1 parent 1542423 commit 4b1e5fe
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 4b1e5fe

Please sign in to comment.