From 6615a10efed116807134dd13afab7dcdb1ffca68 Mon Sep 17 00:00:00 2001 From: Sundog Date: Mon, 9 Sep 2024 11:35:55 -0400 Subject: [PATCH] d --- layout.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/layout.html b/layout.html index aeff07b..726842e 100644 --- a/layout.html +++ b/layout.html @@ -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 ${day_of_schedule.toDateString()}`; - 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); }