diff --git a/static/app.js b/static/app.js index c46ebfc..fd6445e 100644 --- a/static/app.js +++ b/static/app.js @@ -3,13 +3,15 @@ function tick() { for (const el of document.querySelectorAll(".clock[data-started]")) { const secs = Math.max(0, Math.floor((Date.now() - Date.parse(el.dataset.started)) / 1000)); const h = Math.floor(secs / 3600); - const m = String(Math.floor((secs % 3600) / 60)).padStart(2, "0"); + const m = Math.floor((secs % 3600) / 60); const s = String(secs % 60).padStart(2, "0"); - el.textContent = `${h}:${m}:${s}`; + // Pas d'heures à zéro : 4:07, puis 1:04:07. + el.textContent = h ? `${h}:${String(m).padStart(2, "0")}:${s}` : `${m}:${s}`; } } tick(); setInterval(tick, 1000); +htmx.onLoad(tick); // horloges arrivées par htmx (ex. header) // Show server errors from htmx requests in a toast. let toastTimer;