Fix PHP warnings and change from xhtml to html

This commit is contained in:
2025-09-17 15:29:36 +02:00
parent fc93e5097b
commit 31177bc3fc
3 changed files with 28 additions and 18 deletions

View File

@@ -51,6 +51,7 @@ async function init() {
async function updateOverview(client) {
const [schedules] = await Promise.all([getDeliverySchedules(client, [`year=${getCurrentLastSeason()}`])]);
let todayElement = null;
const rows = [];
const days = groupBy(schedules['data'], 'date');
const now = new Date();
@@ -58,8 +59,10 @@ async function updateOverview(client) {
const date = new Date(dateString);
const row = document.createElement('div');
row.className = 'day';
if (now.getFullYear() === date.getFullYear() && now.getMonth() === date.getMonth() && now.getDate() === date.getDate())
if (now.getFullYear() === date.getFullYear() && now.getMonth() === date.getMonth() && now.getDate() === date.getDate()) {
row.classList.add('today');
todayElement = row;
}
row.innerHTML = `<div><span style="font-size: 0.75em; display: block">${fmtDateWeekday(date)}</span>${fmtDate(date)}</div>`;
const container = document.createElement('div');
container.className = 'schedule-container';
@@ -94,7 +97,9 @@ async function updateOverview(client) {
}
const main = document.getElementsByTagName('main')[0];
const numChildren = main.childElementCount;
main.replaceChildren(main.firstElementChild, ...rows);
if (todayElement && numChildren <= 1) todayElement.scrollIntoView({block: "center"});
}
function render() {