diff --git a/changelog.js b/changelog.js index 7fcaacd..22264d6 100644 --- a/changelog.js +++ b/changelog.js @@ -1,7 +1,15 @@ // Version tracking -export const APP_VERSION = '1.0.22'; +export const APP_VERSION = '1.0.23'; export const CHANGELOG = { + '1.0.23': { + date: '2026-02-02', + changes: { + improvements: [ + 'Resolve issue with Reset Day showing incorrect timer value', + ], + }, + }, '1.0.22': { date: '2026-02-02', changes: { diff --git a/cypress/e2e/05-timer-behavior.cy.js b/cypress/e2e/05-timer-behavior.cy.js index d54f510..0ee517f 100644 --- a/cypress/e2e/05-timer-behavior.cy.js +++ b/cypress/e2e/05-timer-behavior.cy.js @@ -44,4 +44,32 @@ describe('Timer Behavior', () => { // Verify timer shows full day countdown cy.get('.timer-display').should('not.have.text', '00:00'); }); + + it('shows the correct timer value when Reset Day is used', () => { + cy.visit('/'); + + cy.get('#settingsDialog').should('be.visible'); + cy.get('#closeSettings').click(); + cy.get('#settingsDialog').should('not.be.visible'); + + // Click Day 1 preset to start the timer and capture its full duration + cy.get('#clocktowerPresets .clocktower-btn') + .first() + .then(($btn) => { + const expectedMinutes = String( + parseInt($btn.attr('data-minutes'), 10) + ).padStart(2, '0'); + const expectedSeconds = String( + parseInt($btn.attr('data-seconds'), 10) + ).padStart(2, '0'); + + cy.get('#clocktowerPresets .clocktower-btn').first().click(); + cy.wait(1000); // Let timer count down briefly + cy.get('#resetBtn').click(); + + // Timer should show the full day value (same as Day 1 preset) + cy.get('#minutes').should('have.text', expectedMinutes); + cy.get('#seconds').should('have.text', expectedSeconds); + }); + }); }); diff --git a/script.js b/script.js index f3fa8ad..0eb9c02 100644 --- a/script.js +++ b/script.js @@ -1573,9 +1573,13 @@ function resetTimer() { wakeUpTimeout = null; } - // Reset to the full day countdown time - const timerValues = calcTimerStartEndValues(playerCount); - timeLeft = timerValues.dayStartValue * 60; // Convert minutes to seconds + // Reset to the full day countdown time (use current day's preset, which includes pace) + const day = currentDay ?? 1; + const presets = generateDayPresets(playerCount); + const preset = presets.find((p) => p.day === day) ?? presets[0]; + timeLeft = preset.minutes * 60 + preset.seconds; + selectedMinutes = preset.minutes; + selectedSeconds = preset.seconds; currentInterval = normalInterval; isRunning = false; // Ensure timer is marked as not running hasReset = true; // Set the reset state