diff --git a/src/lib/formatTime.ts b/src/lib/formatTime.ts index 2139ee8..b4bdb8d 100644 --- a/src/lib/formatTime.ts +++ b/src/lib/formatTime.ts @@ -4,26 +4,15 @@ * @returns Formatted string like "01:23:45 (1h 24m)" or "00:05:23 (5m)" */ export function formatDuration(ms: number): string { - const totalSeconds = Math.floor(ms / 1000); - const hours = Math.floor(totalSeconds / 3600); - const minutes = Math.floor((totalSeconds % 3600) / 60); - const seconds = totalSeconds % 60; - - const timeStr = `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`; - // Calculate rounded version for easy reading const totalMinutes = Math.round(ms / 1000 / 60); - const roundedHours = Math.floor(totalMinutes / 60); - const roundedMinutes = totalMinutes % 60; - - let roundedStr = ''; - if (roundedHours > 0) { - roundedStr = roundedMinutes > 0 ? `${roundedHours}h ${roundedMinutes}m` : `${roundedHours}h`; - } else { - roundedStr = `${roundedMinutes}m`; + const hours = Math.floor(totalMinutes / 60); + const minutes = totalMinutes % 60; + + if (hours > 0) { + return minutes > 0 ? `${hours}h ${minutes}m` : `${hours}h`; } - - return `${timeStr} (${roundedStr})`; + return `${minutes}m`; } /** @@ -33,7 +22,7 @@ export function formatDuration(ms: number): string { * @returns Formatted duration string or "Running..." */ export function formatTimeRange(start: Date, end: Date | null): string { - if (!end) return 'Running...'; + if (!end) return "Running..."; const ms = end.getTime() - start.getTime(); return formatDuration(ms); } diff --git a/src/pages/admin/index.astro b/src/pages/admin/index.astro index bd5a0cf..a1afe6e 100644 --- a/src/pages/admin/index.astro +++ b/src/pages/admin/index.astro @@ -41,7 +41,7 @@ const allUsers = await db.select().from(users).all();
+ + diff --git a/src/pages/dashboard/team.astro b/src/pages/dashboard/team.astro index 77ca18b..504bee3 100644 --- a/src/pages/dashboard/team.astro +++ b/src/pages/dashboard/team.astro @@ -38,7 +38,7 @@ const isAdmin = currentUserMember?.member.role === 'owner' || currentUserMember? ---