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') {