From 1de02ade1eb8e02c0c50b4776072833ab2248264 Mon Sep 17 00:00:00 2001 From: Romulus21 Date: Fri, 13 Nov 2026 19:07:54 +0100 Subject: [PATCH] =?UTF-8?q?Retire=20les=20heures=20=C3=A0=20z=C3=A9ro=20du?= =?UTF-8?q?=20chrono?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 0:02, 4:07 puis 1:04:07 ; les horloges chargées par htmx sont mises à jour dès leur arrivée. Co-Authored-By: Claude Opus 5.5 --- static/app.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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;