Changed the default date and min date for the Tempus Dominus month chooser from strings to the JavaScript Date objects.

This commit is contained in:
依瑪貓 2023-03-19 10:15:32 +08:00
parent 4977847dd8
commit 122b7b059c

View File

@ -175,7 +175,7 @@ class MonthTab extends TabPlane {
let start = monthChooser.dataset.start; let start = monthChooser.dataset.start;
this.#monthChooser = new tempusDominus.TempusDominus(monthChooser, { this.#monthChooser = new tempusDominus.TempusDominus(monthChooser, {
restrictions: { restrictions: {
minDate: start, minDate: new Date(start),
}, },
display: { display: {
inline: true, inline: true,
@ -184,7 +184,7 @@ class MonthTab extends TabPlane {
clock: false, clock: false,
}, },
}, },
defaultDate: monthChooser.dataset.default, defaultDate: new Date(monthChooser.dataset.default),
}); });
monthChooser.addEventListener(tempusDominus.Namespace.events.change, (e) => { monthChooser.addEventListener(tempusDominus.Namespace.events.change, (e) => {
const date = e.detail.date; const date = e.detail.date;