1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-26 22:56:23 -04:00
Files
Sonarr/frontend/src/Utilities/Number/formatRuntime.ts
T
2023-03-15 19:00:08 -07:00

22 lines
340 B
TypeScript

function formatRuntime(runtime: number) {
if (!runtime) {
return '';
}
const hours = Math.floor(runtime / 60);
const minutes = runtime % 60;
const result = [];
if (hours) {
result.push(`${hours}h`);
}
if (minutes) {
result.push(`${minutes}m`);
}
return result.join(' ');
}
export default formatRuntime;