diff options
Diffstat (limited to 'assets/js/src/Namespace.js')
-rw-r--r-- | assets/js/src/Namespace.js | 17 |
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"; +}; |