add a filter to format runtime

This commit is contained in:
OldHawk
2017-04-09 00:37:36 +08:00
parent 354d0edc88
commit 928f4a9559

View File

@@ -0,0 +1,18 @@
(function () {
'use strict';
// Focus the element on page load
// Unless the user is on a small device, because this could obscure the page with a keyboard
angular.module('core')
.filter('runtime', runtime);
runtime.$inject = ['$translate'];
function runtime($translate) {
return function (number) {
if (number === 0 || isNaN(parseFloat(number)) || !isFinite(number)) return '-';
return number + ' ' + $translate.instant('UNIT_MITUTE');
};
}
}());