New: Add runtime format option in Settings > UI so users can choose between a mins view and h/m view
parent
361ffe353d
commit
3548433a10
@ -1,13 +1,15 @@
|
||||
function formatRuntime(minutes) {
|
||||
function formatRuntime(minutes, format) {
|
||||
if (!minutes) {
|
||||
return '0m';
|
||||
return (format === 'hoursMinutes') ? '0m' : '0 mins';
|
||||
}
|
||||
|
||||
if (format === 'minutes') {
|
||||
return `${minutes} mins`;
|
||||
}
|
||||
|
||||
const movieHours = Math.floor(minutes / 60);
|
||||
const movieMinutes = (minutes <= 59) ? minutes : minutes % 60;
|
||||
const formattedRuntime = `${((movieHours > 0) ? `${movieHours}h ` : '') + movieMinutes}m`;
|
||||
|
||||
return formattedRuntime;
|
||||
return `${((movieHours > 0) ? `${movieHours}h ` : '') + movieMinutes}m`;
|
||||
}
|
||||
|
||||
export default formatRuntime;
|
||||
|
@ -0,0 +1,8 @@
|
||||
namespace NzbDrone.Core.Configuration
|
||||
{
|
||||
public enum MovieRuntimeFormatType
|
||||
{
|
||||
HoursMinutes,
|
||||
Minutes
|
||||
}
|
||||
}
|
Loading…
Reference in new issue