Skip to content

Commit 548ef16

Browse files
committed
fix: handle zero-second alarm edge case
1 parent fbc7a56 commit 548ef16

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

Sprint-3/alarmclock/alarmclock.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,15 @@ function updateTime() {
2626
displayTime();
2727

2828
if (timeRemainingInSeconds === 0) {
29+
titleElement.innerText = formatTime(0);
2930
playAlarm();
3031
document.body.classList.add("flash");
31-
clearInterval(alarmTimerIdentifier);
32-
alarmTimerIdentifier = null; // Reset to null for proper state management
32+
return;
3333
}
34+
35+
alarmTimerIdentifier = setInterval(() => {
36+
updateTime();
37+
}, ONE_SECOND_IN_MILLISECONDS);
3438
}
3539

3640
/**

0 commit comments

Comments
 (0)