summaryrefslogtreecommitdiffstats
path: root/module/web/app/scripts/helpers/formatTime.js
diff options
context:
space:
mode:
Diffstat (limited to 'module/web/app/scripts/helpers/formatTime.js')
-rw-r--r--module/web/app/scripts/helpers/formatTime.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/module/web/app/scripts/helpers/formatTime.js b/module/web/app/scripts/helpers/formatTime.js
new file mode 100644
index 000000000..77d67a39c
--- /dev/null
+++ b/module/web/app/scripts/helpers/formatTime.js
@@ -0,0 +1,17 @@
+// Format bytes in human readable format
+define('helpers/formatTime', ['handlebars', 'utils/remaining'], function(Handlebars, Remaining) {
+
+
+ function formatTime(seconds, options) {
+ if (seconds === Infinity)
+ return '∞';
+ else if (!seconds || seconds <= 0)
+ return "-";
+
+ // TODO: digital or written string
+ return Remaining.getStringDigital(seconds, window.dates);
+ }
+
+ Handlebars.registerHelper('formatTime', formatTime);
+ return formatTime;
+}); \ No newline at end of file