Skip to content

Commit 6f6a69e

Browse files
committed
fix session bar to handle negative elapsed time
1 parent 07eb557 commit 6f6a69e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/frontend/components/Standings/SessionBar/SessionBar.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ export const SessionBar = () => {
1717
)}
1818
{timeRemaining <= 86400 && ( // 86400 seconds = 24 hours
1919
<div className="flex flex-1 grow justify-center">
20-
{timeElapsed
21-
? `${formatTimeShort(timeElapsed)} / ${formatTimeShort(timeRemaining, true)} m`
22-
: ''}
20+
{(() => {
21+
const elapsed = formatTimeShort(timeElapsed);
22+
const remaining = formatTimeShort(timeRemaining, true);
23+
return elapsed ? `${elapsed} / ${remaining} m` : `${remaining} m`;
24+
})()}
2325
</div>
2426
)}
2527
<div className="flex flex-1 grow justify-end">

0 commit comments

Comments
 (0)