summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--syweb/webclient/app-filter.js3
-rw-r--r--syweb/webclient/test/unit/filters.spec.js5
2 files changed, 8 insertions, 0 deletions
diff --git a/syweb/webclient/app-filter.js b/syweb/webclient/app-filter.js
index b0971e8493..003e6d3f11 100644
--- a/syweb/webclient/app-filter.js
+++ b/syweb/webclient/app-filter.js
@@ -26,6 +26,9 @@ angular.module('matrixWebClient')
         var h = parseInt(t / (60 * 60)) % 24;
         var d = parseInt(t / (60 * 60 * 24));
         if (t < 60) {
+            if (t < 0) {
+                return "0s";
+            }
             return s + "s";
         }
         if (t < 60 * 60) {
diff --git a/syweb/webclient/test/unit/filters.spec.js b/syweb/webclient/test/unit/filters.spec.js
index e8944cbfc2..fe31da709b 100644
--- a/syweb/webclient/test/unit/filters.spec.js
+++ b/syweb/webclient/test/unit/filters.spec.js
@@ -285,6 +285,11 @@ describe('duration filter', function() {
         var output = durationFilter(1000*60*60*2 + 1000*60*35);
         expect(output).toEqual("2h");
     });
+    
+    it("should represent -ve numbers as '0s'", function() {
+        var output = durationFilter(-2000);
+        expect(output).toEqual("0s");
+    });
 });
 
 describe('orderMembersList filter', function() {