()
| 65 | } |
| 66 | |
| 67 | function buildMonths() { |
| 68 | if (!self.monthsContainer) return; |
| 69 | |
| 70 | clearNode(self.monthsContainer); |
| 71 | |
| 72 | const frag = document.createDocumentFragment(); |
| 73 | |
| 74 | for (let i = 0; i < 12; i++) { |
| 75 | const month = fp.createDay( |
| 76 | "flatpickr-monthSelect-month", |
| 77 | new Date(fp.currentYear, i), |
| 78 | 0, |
| 79 | i |
| 80 | ); |
| 81 | if ( |
| 82 | month.dateObj.getMonth() === new Date().getMonth() && |
| 83 | month.dateObj.getFullYear() === new Date().getFullYear() |
| 84 | ) |
| 85 | month.classList.add("today"); |
| 86 | month.textContent = monthToStr(i, config.shorthand, fp.l10n); |
| 87 | month.addEventListener("click", selectMonth); |
| 88 | frag.appendChild(month); |
| 89 | } |
| 90 | |
| 91 | self.monthsContainer.appendChild(frag); |
| 92 | if ( |
| 93 | fp.config.minDate && |
| 94 | fp.currentYear === fp.config.minDate.getFullYear() |
| 95 | ) |
| 96 | fp.prevMonthNav.classList.add("flatpickr-disabled"); |
| 97 | else fp.prevMonthNav.classList.remove("flatpickr-disabled"); |
| 98 | |
| 99 | if ( |
| 100 | fp.config.maxDate && |
| 101 | fp.currentYear === fp.config.maxDate.getFullYear() |
| 102 | ) |
| 103 | fp.nextMonthNav.classList.add("flatpickr-disabled"); |
| 104 | else fp.nextMonthNav.classList.remove("flatpickr-disabled"); |
| 105 | } |
| 106 | |
| 107 | function bindEvents() { |
| 108 | fp._bind(fp.prevMonthNav, "click", (e) => { |
no test coverage detected
searching dependent graphs…