leesbare tijdseenheid in stats plus timer door laten lopen na einde

This commit is contained in:
2024-12-10 18:55:32 +01:00
parent cf3f5b11ac
commit 2a1a68e969
4 changed files with 48 additions and 55 deletions

View File

@@ -37,35 +37,4 @@ export class FocusService {
this.statsSubject.next(this.localStats);
}
}
private formatDelta(deltaInMs: number) {
const totalSeconds = Math.floor(deltaInMs / 1000);
const hours = Math.floor(totalSeconds / 3600);
const minutes = Math.floor((totalSeconds % 3600) / 60);
const seconds = totalSeconds % 60;
const padZero = (num: number) => num.toString().padStart(2, '0');
return `${padZero(hours)}:${padZero(minutes)}:${padZero(seconds)}`;
}
getFocusCycles(): number {
return this.localStats.focusCycles;
}
getFocusTime(): string {
return this.formatDelta(this.localStats.focusTimeInMs);
}
getShortBreakCycles(): number {
return this.localStats.shortBreakCycles;
}
getLongBreakCycles(): number {
return this.localStats.longBreakCycles;
}
getBreakTime(): string {
return this.formatDelta(this.localStats.breakTimeInMs);
}
}