From 097d6f555a579a93db08f32245b4a33b22ad8eb6 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Wed, 19 Sep 2018 01:23:19 -0400 Subject: [PATCH] displaying seconds in status --- .../components/stream/status/status.component.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/app/components/stream/status/status.component.ts b/src/app/components/stream/status/status.component.ts index 1237c41b..3b1f34df 100644 --- a/src/app/components/stream/status/status.component.ts +++ b/src/app/components/stream/status/status.component.ts @@ -19,14 +19,17 @@ export class StatusComponent implements OnInit { getCompactRelativeTime(d: string): string { const date = (new Date(d)).getTime(); const now = Date.now(); - const timeDelta = (now - date) / (1000 * 60); + const timeDelta = (now - date) / (1000); if (timeDelta < 60) { - return `${timeDelta | 0}m`; - } else if (timeDelta < 60 * 24) { - return `${timeDelta / 60 | 0}h`; - } else if (timeDelta < 60 * 24 * 31) { - return `${timeDelta / (60 * 24) | 0}d`; + return `${timeDelta | 0}s`; + } + if (timeDelta < 60 * 60) { + return `${timeDelta / 60 | 0}m`; + } else if (timeDelta < 60 * 60 * 24) { + return `${timeDelta / (60 * 60)| 0}h`; + } else if (timeDelta < 60 * 60 * 24 * 31) { + return `${timeDelta / (60 * 60 * 24) | 0}d`; } return formatDate(date, 'MM/dd', this.locale);