Skip to content

Commit

Permalink
add a filter to format runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
taobataoma committed Apr 8, 2017
1 parent 354d0ed commit 928f4a9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions modules/core/client/filter/rumtime.client.filter.js
Original file line number Diff line number Diff line change
@@ -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');
};
}
}());

0 comments on commit 928f4a9

Please sign in to comment.