mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Add extra checks to duration filter.
This commit is contained in:
parent
5ebd004a10
commit
d4f6d65e1d
@ -26,6 +26,9 @@ angular.module('matrixWebClient')
|
|||||||
var h = parseInt(t / (60 * 60)) % 24;
|
var h = parseInt(t / (60 * 60)) % 24;
|
||||||
var d = parseInt(t / (60 * 60 * 24));
|
var d = parseInt(t / (60 * 60 * 24));
|
||||||
if (t < 60) {
|
if (t < 60) {
|
||||||
|
if (t < 0) {
|
||||||
|
return "0s";
|
||||||
|
}
|
||||||
return s + "s";
|
return s + "s";
|
||||||
}
|
}
|
||||||
if (t < 60 * 60) {
|
if (t < 60 * 60) {
|
||||||
|
@ -285,6 +285,11 @@ describe('duration filter', function() {
|
|||||||
var output = durationFilter(1000*60*60*2 + 1000*60*35);
|
var output = durationFilter(1000*60*60*2 + 1000*60*35);
|
||||||
expect(output).toEqual("2h");
|
expect(output).toEqual("2h");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should represent -ve numbers as '0s'", function() {
|
||||||
|
var output = durationFilter(-2000);
|
||||||
|
expect(output).toEqual("0s");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('orderMembersList filter', function() {
|
describe('orderMembersList filter', function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user