small adaptions

This commit is contained in:
2026-02-16 19:28:23 +01:00
parent 9206453394
commit c516a097a3
3 changed files with 85 additions and 7 deletions

View File

@@ -30,6 +30,19 @@ export function formatDuration(totalSeconds: number): string {
return parts.join(":");
}
export function formatDurationHoursMinutes(totalSeconds: number): string {
const hours = Math.floor(totalSeconds / 3600);
const minutes = Math.floor((totalSeconds % 3600) / 60);
if (hours === 0) {
return `${minutes}m`;
}
if (minutes === 0) {
return `${hours}h`;
}
return `${hours}h ${minutes}m`;
}
export function calculateDuration(startTime: string, endTime: string): number {
const start = parseISO(startTime);
const end = parseISO(endTime);