From 0d668c3f1b1dae3a24aa70108818eaecdc9deef4 Mon Sep 17 00:00:00 2001 From: Kieran Klukas Date: Fri, 24 Apr 2026 22:39:02 -0400 Subject: [PATCH] feat: expand up to days in timer --- ui/templates/recipe.html | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/ui/templates/recipe.html b/ui/templates/recipe.html index fe9f14f..affedd7 100644 --- a/ui/templates/recipe.html +++ b/ui/templates/recipe.html @@ -252,10 +252,24 @@ function closeTimer() { } function updateTimerDisplay() { - const m = Math.floor(timerRemaining / 60); + const h = Math.floor(timerRemaining / 3600); + const m = Math.floor((timerRemaining % 3600) / 60); const s = timerRemaining % 60; - document.getElementById('timer-display').textContent = - String(m).padStart(2, '0') + ':' + String(s).padStart(2, '0'); + const mStr = String(m).padStart(2, '0'); + const sStr = String(s).padStart(2, '0'); + if (h > 0) { + const d = Math.floor(h / 24); + const hRem = h % 24; + if (d > 0) { + document.getElementById('timer-display').textContent = + d + 'd ' + String(hRem).padStart(2, '0') + ':' + mStr + ':' + sStr; + } else { + document.getElementById('timer-display').textContent = + String(h).padStart(2, '0') + ':' + mStr + ':' + sStr; + } + } else { + document.getElementById('timer-display').textContent = mStr + ':' + sStr; + } } if ('Notification' in window && Notification.permission === 'default') { -- 2.51.2