summaryrefslogtreecommitdiff
path: root/web/share/js/tools.js
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-06-20 11:29:06 +0300
committerDevaev Maxim <[email protected]>2020-06-20 11:29:06 +0300
commitcf2f763d1bd23170cb82e0df9eff363931cc66dc (patch)
tree541f6cd3b498d2a6ccde3e0921639a588535fdba /web/share/js/tools.js
parent490e5b352ef569ef5b3f5211523d21bbd5ed0e1c (diff)
user macro
Diffstat (limited to 'web/share/js/tools.js')
-rw-r--r--web/share/js/tools.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/web/share/js/tools.js b/web/share/js/tools.js
index 8212b62f..e3fa3892 100644
--- a/web/share/js/tools.js
+++ b/web/share/js/tools.js
@@ -64,6 +64,17 @@ export var tools = new function() {
}
};
+ this.formatDuration = function(duration) {
+ let millis = parseInt((duration % 1000) / 100);
+ let secs = Math.floor((duration / 1000) % 60);
+ let mins = Math.floor((duration / (1000 * 60)) % 60);
+ let hours = Math.floor((duration / (1000 * 60 * 60)) % 24);
+ hours = (hours < 10 ? "0" + hours : hours);
+ mins = (mins < 10 ? "0" + mins : mins);
+ secs = (secs < 10 ? "0" + secs : secs);
+ return `${hours}:${mins}:${secs}.${millis}`;
+ };
+
/************************************************************************/
this.getCookie = function(name) {