/** Длительность в «ч:мм:сс» (часы — только когда есть); null — прочерк. */ export function formatDuration(seconds: number | null): string { if (seconds == null) return '—' const total = Math.round(seconds) const h = Math.floor(total / 3600) const m = Math.floor((total % 3600) / 60) const s = total % 60 const pad = (n: number) => String(n).padStart(2, '0') return h > 0 ? `${h}:${pad(m)}:${pad(s)}` : `${m}:${pad(s)}` }