Aquileo | Library |

Search UC Library, website & more

'; }).join("") + '
'; }).join(""); grid.innerHTML = html; } function init() { var now = new Date(); var stamp = document.getElementById("lh-today"); if (stamp) { stamp.textContent = now.toLocaleDateString(undefined, { weekday: "long", month: "long", day: "numeric" }); } // Render defaults immediately so hours never depend on the API responding render([], now); fetch(API + "?from=" + apiDate(now) + "&to=" + apiDate(now)) .then(function (res) { return res.ok ? res.json() : []; }) .then(function (data) { if (!Array.isArray(data)) { return; } var today = new Date(now.getFullYear(), now.getMonth(), now.getDate()); // Belt and braces: the API filters by range, but confirm today is inside it var active = data.filter(function (ex) { var s = parseApiDate(ex.started_at), e = parseApiDate(ex.ended_at); return s && e && today >= s && today