diff options
author | zacharystenger <zackstenger@gmail.com> | 2019-02-12 00:16:15 -0800 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-02-12 09:16:15 +0100 |
commit | ec24796ea83dbe15863c4f074844abbb4cdd5e08 (patch) | |
tree | 2342c9f3aa15fdadf21f61bdee9c46b456f16e7b /client/src | |
parent | 7519127b5cb44095f78f6bf4c51d4ebf2b7d5e88 (diff) | |
download | PeerTube-ec24796ea83dbe15863c4f074844abbb4cdd5e08.tar.gz PeerTube-ec24796ea83dbe15863c4f074844abbb4cdd5e08.tar.zst PeerTube-ec24796ea83dbe15863c4f074844abbb4cdd5e08.zip |
Fix negative seconds by displaying 0 instead (#1445) (#1625)
* Fix from-now.pipe.ts so it never displays negative seconds
* Apply the fix only when returning seconds. Remove redundant Math.floor operation
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/app/shared/misc/from-now.pipe.ts | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/client/src/app/shared/misc/from-now.pipe.ts b/client/src/app/shared/misc/from-now.pipe.ts index 00b5be6c9..3a9a76411 100644 --- a/client/src/app/shared/misc/from-now.pipe.ts +++ b/client/src/app/shared/misc/from-now.pipe.ts | |||
@@ -35,6 +35,6 @@ export class FromNowPipe implements PipeTransform { | |||
35 | interval = Math.floor(seconds / 60) | 35 | interval = Math.floor(seconds / 60) |
36 | if (interval >= 1) return this.i18n('{{interval}} min ago', { interval }) | 36 | if (interval >= 1) return this.i18n('{{interval}} min ago', { interval }) |
37 | 37 | ||
38 | return this.i18n('{{interval}} sec ago', { interval: Math.floor(seconds) }) | 38 | return this.i18n('{{interval}} sec ago', { interval: Math.max(0, seconds) }) |
39 | } | 39 | } |
40 | } | 40 | } |