summaryrefslogtreecommitdiff
path: root/assets/js/src/Namespace.js
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-11-21 22:50:57 -0500
committerFrederic Guillot <fred@kanboard.net>2016-11-21 22:50:57 -0500
commit8976f4d15c151afaf2249c526c6a42463e98f491 (patch)
tree990ee2b73ad171b0d04fc199e6d20242e80da8da /assets/js/src/Namespace.js
parenta3bb27109dc01fa5df2c771b84620f1e8f56b849 (diff)
Use components to render charts
Diffstat (limited to 'assets/js/src/Namespace.js')
-rw-r--r--assets/js/src/Namespace.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/assets/js/src/Namespace.js b/assets/js/src/Namespace.js
index e6ca1ed3..de825be4 100644
--- a/assets/js/src/Namespace.js
+++ b/assets/js/src/Namespace.js
@@ -3,7 +3,8 @@
var Kanboard = {};
var KB = {
- components: {}
+ components: {},
+ utils: {}
};
KB.component = function (name, object) {
@@ -109,3 +110,17 @@ KB.el = function (tag) {
return new DOMBuilder(tag);
};
+
+KB.utils.formatDuration = function(d) {
+ if (d >= 86400) {
+ return Math.round(d/86400) + "d";
+ }
+ else if (d >= 3600) {
+ return Math.round(d/3600) + "h";
+ }
+ else if (d >= 60) {
+ return Math.round(d/60) + "m";
+ }
+
+ return d + "s";
+};