From 4c73ebe644e7b781fee57bb295f8819bf6568628 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Fri, 9 Oct 2020 21:48:38 +0300 Subject: feat: display 'just now' if was just posted --- src/components/DateString/compactDateString.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/DateString/compactDateString.ts b/src/components/DateString/compactDateString.ts index dffd912..f067b1a 100644 --- a/src/components/DateString/compactDateString.ts +++ b/src/components/DateString/compactDateString.ts @@ -28,6 +28,7 @@ const resolve = (value: number, metricIndex = 0): string => { const compactDateString = (date: Date): string => { const now = new Date(); const diff = (now.valueOf() - date.valueOf()) / 1000; + if (diff < 60) return 'just now'; return resolve(diff); }; -- cgit v1.2.3