diff --git a/src/accounting/static/js/period-chooser.js b/src/accounting/static/js/period-chooser.js index faa4f8f..b84061a 100644 --- a/src/accounting/static/js/period-chooser.js +++ b/src/accounting/static/js/period-chooser.js @@ -24,7 +24,7 @@ // Initializes the page JavaScript. document.addEventListener("DOMContentLoaded", () => { - new PeriodChooser(); + PeriodChooser.initialize(); }); /** @@ -63,6 +63,20 @@ class PeriodChooser { this.tabPlanes[tab.tabId()] = tab; } } + + /** + * The period chooser. + * @type {PeriodChooser} + */ + static #chooser; + + /** + * Initializes the period chooser. + * + */ + static initialize() { + this.#chooser = new PeriodChooser(); + } } /** @@ -143,6 +157,12 @@ class TabPlane { */ class MonthTab extends TabPlane { + /** + * The month chooser. + * @type {tempusDominus.TempusDominus} + */ + #monthChooser + /** * Constructs a tab plane. * @@ -152,7 +172,7 @@ class MonthTab extends TabPlane { super(chooser); const monthChooser = document.getElementById(this.prefix + "-chooser"); let start = monthChooser.dataset.start; - new tempusDominus.TempusDominus(monthChooser, { + this.#monthChooser = new tempusDominus.TempusDominus(monthChooser, { restrictions: { minDate: start, },