Changed setInitialDate in dates_popup

This commit is contained in:
l_samenv
2024-08-27 15:42:34 +02:00
parent 43a4bbdbe1
commit 310582cd06

View File

@ -54,23 +54,26 @@ class DatesPopup extends HTMLElement{
}
show(){
this.setInitialDates();
this.style.visibility = "visible";
}
setInitialDate(){
setInitialDates(){
let currentDate = new Date();
let correctedCurrentDate = new Date(Date.UTC(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()));
let dateInput = this.getElementsByClassName("input-date")[0];
let dateDayBefore = new Date(currentDate - DatesPopup.DAY);
let dateDayBefore = new Date(correctedCurrentDate - DatesPopup.DAY);
dateInput.valueAsDate = dateDayBefore;
this.getElementsByClassName("input-date")[0].max = correctedCurrentDate.toISOString().split("T")[0]; // sets the max to today (set only at app start)
}
connectedCallback(){
this.render();
this.setInitialDate();
this.hide();
this.getElementsByTagName("img")[0].onclick = () => {this.hide();};
this.getElementsByClassName("go-to-now-button")[0].onclick = () => {this.doGoToNowCallback();};
this.getElementsByClassName("input-date")[0].max = new Date().toISOString().split("T")[0]; // sets the max to today (set only at app start)
this.getElementsByClassName("jump-button")[0].onclick = () => {this.doJumpCallback();};
}