/
outbreak
/
kilocode
Обзор
Документация
Войти
/
outbreak
/
kilocode
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
apps/web-roo-code/src/lib/format-duration.ts
26 строк
565 B
roomote[bot]
feat: show dash instead of zero for missing data on evals page (#7748)
07 сен 2025, 00:15
Не верифицирован
07 сен 2025, 00:15
9378a4e
Код
Авторство
О чём код?
export const formatDuration = (durationMs: number | null | undefined) => { if (durationMs === null || durationMs === undefined) { return "-" } const seconds = Math.floor(durationMs / 1000) const hours = Math.floor(seconds / 3600) const minutes = Math.floor((seconds % 3600) / 60) const remainingSeconds = seconds % 60 const parts = [] if (hours > 0) { parts.push(`${hours}h`) } if (minutes > 0) { parts.push(`${minutes}m`) } if (remainingSeconds > 0 || parts.length === 0) { parts.push(`${remainingSeconds}s`) } return parts.join(" ") }