(elapsedSeconds: number)
| 17 | * - 3600+ seconds (1+ hours): "Xh" or "Xh Ym" (e.g., "1h", "2h 15m") |
| 18 | */ |
| 19 | export const formatElapsedTime = (elapsedSeconds: number): string => { |
| 20 | if (elapsedSeconds < 60) { |
| 21 | return `${elapsedSeconds}s` |
| 22 | } |
| 23 | |
| 24 | const hours = Math.floor(elapsedSeconds / 3600) |
| 25 | const minutes = Math.floor((elapsedSeconds % 3600) / 60) |
| 26 | const seconds = elapsedSeconds % 60 |
| 27 | |
| 28 | if (hours > 0) { |
| 29 | return `${hours}h` + (minutes > 0 ? ` ${minutes}m` : '') |
| 30 | } |
| 31 | |
| 32 | return `${minutes}m` + (seconds > 0 ? ` ${seconds}s` : '') |
| 33 | } |
no outgoing calls
no test coverage detected