From 71d2019b02c35fdce46661051c9a1b4c87438206 Mon Sep 17 00:00:00 2001 From: Yury Uvarov Date: Mon, 2 Oct 2023 18:08:28 +0300 Subject: [PATCH] fix logic for creating activeMonthsID array --- package/src/scripts/methods/createMonths.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/src/scripts/methods/createMonths.ts b/package/src/scripts/methods/createMonths.ts index 1a7ac38d..61a321d5 100644 --- a/package/src/scripts/methods/createMonths.ts +++ b/package/src/scripts/methods/createMonths.ts @@ -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;