d
This commit is contained in:
parent
6615a10efe
commit
ebc210d091
10
layout.html
10
layout.html
@ -616,7 +616,7 @@
|
||||
});
|
||||
|
||||
const init_schedules = (day) => {
|
||||
const day_of_schedule = new Date(day) || new Date();
|
||||
const day_of_schedule = new Date(Date.parse(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", day_of_schedule.getDate());
|
||||
current_day_indicator.setAttribute("data-day", day_of_schedule.toISOString());
|
||||
// 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,14 @@
|
||||
|
||||
const previous_day_schedule = (e) => {
|
||||
e.preventDefault();
|
||||
const day = new Date().setDate(e.target.getAttribute("data-day") - 1);
|
||||
const day = new Date(e.target.getAttribute("data-day"));
|
||||
day.setDate(day.getDate() - 1);
|
||||
init_schedules(day);
|
||||
}
|
||||
const next_day_schedule = (e) => {
|
||||
e.preventDefault();
|
||||
const day = new Date.setDate(e.target.getAttribute("data-day") + 86400);
|
||||
const day = new Date(e.target.getAttribute("data-day"));
|
||||
day.setDate(day.getDate() + 1);
|
||||
init_schedules(day);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user