fix paused (#486)

* fix: prevent timer continue on paused count up

* refactor: throw if not found on delete
This commit is contained in:
Carlos Valente
2023-08-12 11:24:35 +02:00
committed by GitHub
parent 023aac4ead
commit f3610059ef
5 changed files with 28 additions and 46 deletions
-15
View File
@@ -47,18 +47,3 @@ export function getCurrent(
}
return startedAt + duration + addedTime + pausedTime - clock;
}
/**
* Calculates elapsed time
*/
export function getElapsed(startedAt: number | null, clock: number): number | null {
if (startedAt === null) {
return null;
}
// we are in the day after
if (startedAt > clock) {
return dayInMs - startedAt + clock;
}
return clock - startedAt;
}