diff --git a/src/public/app/widgets/buttons/calendar.js b/src/public/app/widgets/buttons/calendar.js index d3a43c822..e99ac4aaa 100644 --- a/src/public/app/widgets/buttons/calendar.js +++ b/src/public/app/widgets/buttons/calendar.js @@ -35,9 +35,13 @@ const DROPDOWN_TPL = `
- + +
@@ -82,9 +86,11 @@ export default class CalendarWidget extends RightDropdownButtonWidget { // Month navigation this.$monthSelect = this.$dropdownContent.find('[data-calendar-input="month"]'); - this.$monthSelect.on("input", (e) => { - this.date.setMonth(e.target.value); + this.monthDropdown = bootstrap.Dropdown.getOrCreateInstance(this.$monthSelect); + this.$dropdownContent.find('[data-calendar-input="month-list"] button').on("click", (e) => { + this.date.setMonth(e.target.dataset.value); this.createMonth(); + this.monthDropdown.hide(); }); this.$next = this.$dropdownContent.find('[data-calendar-toggle="next"]'); this.$next.on('click', () => { @@ -234,7 +240,7 @@ export default class CalendarWidget extends RightDropdownButtonWidget { this.date.setDate(1); this.date.setMonth(this.date.getMonth() - 1); - this.$monthSelect.val(this.date.getMonth()); + this.$monthSelect.text(MONTHS[this.date.getMonth()]); this.$yearSelect.val(this.date.getFullYear()); }