Fixed the JavaScript period chooser error when there is no data.
This commit is contained in:
parent
af71874f9d
commit
7feb6da062
@ -171,6 +171,7 @@ class MonthTab extends TabPlane {
|
||||
constructor(chooser) {
|
||||
super(chooser);
|
||||
const monthChooser = document.getElementById(this.prefix + "-chooser");
|
||||
if (monthChooser !== null) {
|
||||
let start = monthChooser.dataset.start;
|
||||
this.#monthChooser = new tempusDominus.TempusDominus(monthChooser, {
|
||||
restrictions: {
|
||||
@ -194,6 +195,7 @@ class MonthTab extends TabPlane {
|
||||
.replaceAll("PERIOD", period);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The tab ID
|
||||
@ -250,6 +252,7 @@ class DayTab extends TabPlane {
|
||||
super(chooser);
|
||||
this.#date = document.getElementById(this.prefix + "-date");
|
||||
this.#dateError = document.getElementById(this.prefix + "-date-error");
|
||||
if (this.#date !== null) {
|
||||
this.#date.onchange = () => {
|
||||
if (this.#validateDate()) {
|
||||
window.location = chooser.modal.dataset.urlTemplate
|
||||
@ -257,6 +260,7 @@ class DayTab extends TabPlane {
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the date.
|
||||
@ -338,6 +342,7 @@ class CustomTab extends TabPlane {
|
||||
this.#end = document.getElementById(this.prefix + "-end");
|
||||
this.#endError = document.getElementById(this.prefix + "-end-error");
|
||||
this.#conform = document.getElementById(this.prefix + "-confirm");
|
||||
if (this.#start !== null) {
|
||||
this.#start.onchange = () => {
|
||||
if (this.#validateStart()) {
|
||||
this.#end.min = this.#start.value;
|
||||
@ -358,6 +363,7 @@ class CustomTab extends TabPlane {
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the start of the period.
|
||||
|
Loading…
Reference in New Issue
Block a user