d
This commit is contained in:
parent
b123018fe4
commit
6615a10efe
@ -616,7 +616,7 @@
|
||||
});
|
||||
|
||||
const init_schedules = (day) => {
|
||||
const day_of_schedule = new Date(day) || new Date(Date.now());
|
||||
const day_of_schedule = new Date(day) || new Date();
|
||||
console.dir(day_of_schedule);
|
||||
|
||||
for (let i = 0; i < 8; i++) {
|
||||
@ -624,7 +624,7 @@
|
||||
// first column of schedule, set up the grid
|
||||
const current_day_indicator = document.querySelector("#current_day_indicator");
|
||||
current_day_indicator.innerHTML = `Schedule for <strong>${day_of_schedule.toDateString()}</strong>`;
|
||||
current_day_indicator.setAttribute("data-day", new Date(day_of_schedule).getSeconds() / 1000);
|
||||
current_day_indicator.setAttribute("data-day", day_of_schedule.getDate());
|
||||
// set up previous/next buttons
|
||||
document.querySelector('#previous_day_button').addEventListener("click", previous_day_schedule);
|
||||
document.querySelector('#next_day_button').addEventListener("click", next_day_schedule);
|
||||
@ -639,12 +639,12 @@
|
||||
|
||||
const previous_day_schedule = (e) => {
|
||||
e.preventDefault();
|
||||
const day = new Date(e.target.getAttribute("data-day") - 86400);
|
||||
const day = new Date().setDate(e.target.getAttribute("data-day") - 1);
|
||||
init_schedules(day);
|
||||
}
|
||||
const next_day_schedule = (e) => {
|
||||
e.preventDefault();
|
||||
const day = new Date(e.target.getAttribute("data-day") + 86400);
|
||||
const day = new Date.setDate(e.target.getAttribute("data-day") + 86400);
|
||||
init_schedules(day);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user