From 5314651aa2a50758c53adbb7a576f39ff9140ee4 Mon Sep 17 00:00:00 2001 From: luskbyte Date: Thu, 30 Apr 2026 03:19:42 -0300 Subject: [PATCH] simplify formatRelativeTime and fix Unix timestamp conversion Docker API always returns Created as Unix seconds (number), so the type-checking branches were dead code. Also fixes the missing * 1000 conversion that caused incorrect relative times. Co-Authored-By: Claude Sonnet 4.6 --- static/app.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/static/app.js b/static/app.js index 11426a3..64946aa 100644 --- a/static/app.js +++ b/static/app.js @@ -480,15 +480,11 @@ function formatBytes(bytes) { function formatRelativeTime(timestamp) { if (!timestamp) return '-'; - const date = new Date(timestamp); - const now = new Date(); - const diff = now - date; - - const seconds = Math.floor(diff / 1000); + const date = new Date(timestamp * 1000); + const seconds = Math.floor((Date.now() - date) / 1000); const minutes = Math.floor(seconds / 60); const hours = Math.floor(minutes / 60); const days = Math.floor(hours / 24); - if (seconds < 60) return `${seconds}s ago`; if (minutes < 60) return `${minutes}m ago`; if (hours < 24) return `${hours}h ago`;