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 <noreply@anthropic.com>
This commit is contained in:
+2
-6
@@ -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`;
|
||||
|
||||
Reference in New Issue
Block a user