fix: guard formatDuration against NaN/Infinity input

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
xRangerDE
2026-03-22 15:23:21 +01:00
co-authored by Claude Opus 4.6
parent 18940d0640
commit da1d14d458
+2
View File
@@ -688,6 +688,7 @@ function parseDuration(duration: string): number {
}
function formatDuration(seconds: number): string {
if (!isFinite(seconds) || seconds < 0) return '00:00:00';
const h = Math.floor(seconds / 3600);
const m = Math.floor((seconds % 3600) / 60);
const s = Math.floor(seconds % 60);
@@ -695,6 +696,7 @@ function formatDuration(seconds: number): string {
}
function formatDurationDashed(seconds: number): string {
if (!isFinite(seconds) || seconds < 0) return '00-00-00';
const h = Math.floor(seconds / 3600);
const m = Math.floor((seconds % 3600) / 60);
const s = Math.floor(seconds % 60);