aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-10-09 21:48:38 +0300
committereug-vs <eug-vs@keemail.me>2020-10-09 21:48:38 +0300
commit4c73ebe644e7b781fee57bb295f8819bf6568628 (patch)
tree93b6cbf12de185938142d14e2924a90cdec5b73c
parent31900353b6ea3e4570c15d1c1585685b4413d6d9 (diff)
downloadwhich-ui-4c73ebe644e7b781fee57bb295f8819bf6568628.tar.gz
feat: display 'just now' if was just posted
-rw-r--r--src/components/DateString/compactDateString.ts1
1 files changed, 1 insertions, 0 deletions
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);
};