Skip to content

Commit

Permalink
fix logic for creating activeMonthsID array
Browse files Browse the repository at this point in the history
  • Loading branch information
uvarov-frontend committed Oct 2, 2023
1 parent 0c0c8d6 commit 71d2019
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package/src/scripts/methods/createMonths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ const createMonths = (self: IVanillaCalendar, target?: HTMLElement) => {

if (self.settings.selection.month) monthsEl.classList.add(self.CSSClasses.monthsSelecting);

const activeMonthsID = self.locale.months
const activeMonthsID = self.jumpMonths > 1 ? self.locale.months
.map((_, i) => selectedMonth - self.jumpMonths * i)
.concat(self.locale.months.map((_, i) => selectedMonth + self.jumpMonths * i))
.filter((monthID) => monthID >= 0 && monthID <= 12);
.filter((monthID) => monthID >= 0 && monthID <= 12) : Array.from(Array(12).keys());
const templateMonthEl = document.createElement('button');
templateMonthEl.type = 'button';
templateMonthEl.className = self.CSSClasses.monthsMonth;
Expand Down

0 comments on commit 71d2019

Please sign in to comment.