(minutes: number)
| 195 | * Format time in minutes to a readable string (e.g., "1h 30m", "45m") |
| 196 | */ |
| 197 | export function formatTime(minutes: number): string { |
| 198 | if (!minutes || minutes === 0 || isNaN(minutes)) { |
| 199 | return "0m"; |
| 200 | } |
| 201 | |
| 202 | const hours = Math.floor(minutes / 60); |
| 203 | const mins = minutes % 60; |
| 204 | |
| 205 | if (hours === 0) return `${mins}m`; |
| 206 | if (mins === 0) return `${hours}h`; |
| 207 | return `${hours}h ${mins}m`; |
| 208 | } |
| 209 | |
| 210 | /** |
| 211 | * Parses a time string in the format HH:MM and returns hours and minutes |
no outgoing calls
no test coverage detected