From ec24796ea83dbe15863c4f074844abbb4cdd5e08 Mon Sep 17 00:00:00 2001 From: zacharystenger Date: Tue, 12 Feb 2019 00:16:15 -0800 Subject: [PATCH] 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 --- client/src/app/shared/misc/from-now.pipe.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 { interval = Math.floor(seconds / 60) if (interval >= 1) return this.i18n('{{interval}} min ago', { interval }) - return this.i18n('{{interval}} sec ago', { interval: Math.floor(seconds) }) + return this.i18n('{{interval}} sec ago', { interval: Math.max(0, seconds) }) } }