cleanup: millisToSeconds

This commit is contained in:
arc-alex
2025-05-10 20:17:05 +02:00
parent 55c6e70f4a
commit bf3d426649
@@ -19,16 +19,17 @@ export function millisToSeconds(
) {
if (millis === null) return 0;
let seconds = 0;
if (direction === TimerType.CountDown) {
// 0 + is there to avoid result giving -0
return 0 + Math.ceil(millis / MILLIS_PER_SECOND);
seconds = Math.ceil(millis / MILLIS_PER_SECOND);
}
if (direction === TimerType.CountUp) {
return Math.floor(millis / MILLIS_PER_SECOND);
seconds = Math.floor(millis / MILLIS_PER_SECOND);
}
throw new Error('?????');
// this is there to avoid result giving -0
return seconds === 0 ? 0 : seconds;
}
/**