forked from platypush/platypush
27 lines
667 B
JavaScript
27 lines
667 B
JavaScript
var utils = {
|
|
methods: {
|
|
convertTime: function(time) {
|
|
time = parseFloat(time); // Normalize strings
|
|
var t = {};
|
|
t.h = '' + parseInt(time/3600);
|
|
t.m = '' + parseInt(time/60 - t.h*60);
|
|
t.s = '' + parseInt(time - (t.h*3600 + t.m*60));
|
|
|
|
for (var attr of ['m','s']) {
|
|
if (parseInt(t[attr]) < 10) {
|
|
t[attr] = '0' + t[attr];
|
|
}
|
|
}
|
|
|
|
var ret = [];
|
|
if (parseInt(t.h)) {
|
|
ret.push(t.h);
|
|
}
|
|
|
|
ret.push(t.m, t.s);
|
|
return ret.join(':');
|
|
},
|
|
},
|
|
};
|
|
|