()
| 990 | } |
| 991 | |
| 992 | function buildMonth() { |
| 993 | const container = createElement("div", "flatpickr-month"); |
| 994 | const monthNavFragment = window.document.createDocumentFragment(); |
| 995 | |
| 996 | let monthElement; |
| 997 | |
| 998 | if ( |
| 999 | self.config.showMonths > 1 || |
| 1000 | self.config.monthSelectorType === "static" |
| 1001 | ) { |
| 1002 | monthElement = createElement<HTMLSpanElement>("span", "cur-month"); |
| 1003 | } else { |
| 1004 | self.monthsDropdownContainer = createElement<HTMLSelectElement>( |
| 1005 | "select", |
| 1006 | "flatpickr-monthDropdown-months" |
| 1007 | ); |
| 1008 | |
| 1009 | self.monthsDropdownContainer.setAttribute( |
| 1010 | "aria-label", |
| 1011 | self.l10n.monthAriaLabel |
| 1012 | ); |
| 1013 | |
| 1014 | bind(self.monthsDropdownContainer, "change", (e: Event) => { |
| 1015 | const target = getEventTarget(e) as HTMLSelectElement; |
| 1016 | const selectedMonth = parseInt(target.value, 10); |
| 1017 | |
| 1018 | self.changeMonth(selectedMonth - self.currentMonth); |
| 1019 | |
| 1020 | triggerEvent("onMonthChange"); |
| 1021 | }); |
| 1022 | |
| 1023 | buildMonthSwitch(); |
| 1024 | |
| 1025 | monthElement = self.monthsDropdownContainer; |
| 1026 | } |
| 1027 | |
| 1028 | const yearInput = createNumberInput("cur-year", { tabindex: "-1" }); |
| 1029 | |
| 1030 | const yearElement = yearInput.getElementsByTagName( |
| 1031 | "input" |
| 1032 | )[0] as HTMLInputElement; |
| 1033 | yearElement.setAttribute("aria-label", self.l10n.yearAriaLabel); |
| 1034 | |
| 1035 | if (self.config.minDate) { |
| 1036 | yearElement.setAttribute( |
| 1037 | "min", |
| 1038 | self.config.minDate.getFullYear().toString() |
| 1039 | ); |
| 1040 | } |
| 1041 | |
| 1042 | if (self.config.maxDate) { |
| 1043 | yearElement.setAttribute( |
| 1044 | "max", |
| 1045 | self.config.maxDate.getFullYear().toString() |
| 1046 | ); |
| 1047 | |
| 1048 | yearElement.disabled = |
| 1049 | !!self.config.minDate && |
no test coverage detected
searching dependent graphs…