mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-27 23:06:29 -04:00
c522cd120d
* New: Rework List sync interval logic Fixes #5011
26 lines
498 B
JavaScript
26 lines
498 B
JavaScript
import moment from 'moment';
|
|
|
|
function formatShortTimeSpan(timeSpan) {
|
|
if (!timeSpan) {
|
|
return '';
|
|
}
|
|
|
|
const duration = moment.duration(timeSpan);
|
|
|
|
const hours = Math.floor(duration.asHours());
|
|
const minutes = Math.floor(duration.asMinutes());
|
|
const seconds = Math.floor(duration.asSeconds());
|
|
|
|
if (hours > 0) {
|
|
return `${hours} hour(s)`;
|
|
}
|
|
|
|
if (minutes > 0) {
|
|
return `${minutes} minute(s)`;
|
|
}
|
|
|
|
return `${seconds} second(s)`;
|
|
}
|
|
|
|
export default formatShortTimeSpan;
|