Skip to content

Commit

Permalink
Fix display not updating when time changed on pause
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans5958 committed Dec 21, 2024
1 parent 716ee10 commit cbfd7ea
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/components/Timer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ function remove() {
* Update both display (hh:mm:ss and miliseconds)
* @param {number} targetTime
*/
function updateDisplay(targetTime) {
if (isStopped) return
function updateDisplay(targetTime, force=false) {
if (isStopped && !force) return
let nowTimestamp = Date.now()
if (targetTime) {
if (countingUp.value) targetTimestamp = nowTimestamp - targetTime
Expand Down Expand Up @@ -224,7 +224,6 @@ async function retime() {
showCancelButton: true,
inputValidator: (input) => {
let inputSecs = convertTimeFromString(input)
console.log(inputSecs)
if (Number.isNaN(Number(inputSecs))) {
return 'Enter a valid value!'
} else if (inputSecs < 0) {
Expand All @@ -236,7 +235,7 @@ async function retime() {
if (!input) return
defaultSeconds = convertTimeFromString(input) * 1000
updateDisplay(defaultSeconds)
updateDisplay(defaultSeconds, true)
if (pausedDifference) pausedDifference += defaultSeconds
}
Expand Down

0 comments on commit cbfd7ea

Please sign in to comment.