Files
dss.web/client/app/helpers/humanise.js
Fergal Moran d2c529bafe Screw you git!
2015-12-01 19:50:20 +00:00

18 lines
480 B
JavaScript

var helpers = helpers || {};
helpers.humanise = {
humaniseTime: function (input) {
var d, h, m, s;
if (input) {
d = Number(input);
h = Math.floor(d / 3600);
m = Math.floor(d % 3600 / 60);
s = Math.floor(d % 3600 % 60);
return (h > 0 ? h + ":" : "") + (m > 0 ? (h > 0 && m < 10 ? "0" : "") + m + ":" : "00:") + (s < 10 ? "0" : "") + s;
} else {
return "0:00";
}
}
};