export function formatBytes(bytes: number): string { if (!Number.isFinite(bytes) || bytes < 0) return "—"; const units = ["B", "KB", "MB", "GB", "TB"]; let value = bytes; let unit = 0; while (value >= 1024 && unit < units.length - 1) { value /= 1024; unit += 1; } const digits = value >= 100 || unit === 0 ? 0 : 1; return `${value.toFixed(digits)} ${units[unit]}`; } export function formatDate(value: string): string { return new Date(value).toLocaleDateString(undefined, { year: "numeric", month: "short", day: "numeric", }); }