From 92c3e19865b077308f3b42eb3830efbf4ab6e9f1 Mon Sep 17 00:00:00 2001 From: Mikunj Date: Wed, 21 Aug 2019 13:04:18 +1000 Subject: [PATCH] Don't show relative timestamp. --- ts/util/formatRelativeTime.ts | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/ts/util/formatRelativeTime.ts b/ts/util/formatRelativeTime.ts index 80796dc51..6b83bb70a 100644 --- a/ts/util/formatRelativeTime.ts +++ b/ts/util/formatRelativeTime.ts @@ -12,13 +12,6 @@ const getShortFormats = (i18n: LocalizerType) => ({ d: 'ddd', }); -function isToday(timestamp: moment.Moment) { - const today = moment().format('ddd'); - const targetDay = moment(timestamp).format('ddd'); - - return today === targetDay; -} - function isYear(timestamp: moment.Moment) { const year = moment().format('YYYY'); const targetYear = moment(timestamp).format('YYYY'); @@ -41,17 +34,7 @@ export function formatRelativeTime( return timestamp.format(formats.y); } else if (diff.months() >= 1 || diff.days() > 6) { return timestamp.format(formats.M); - } else if (diff.days() >= 1 || !isToday(timestamp)) { - return timestamp.format(formats.d); - } else if (diff.hours() >= 1) { - const key = extended ? 'hoursAgo' : 'hoursAgoShort'; - - return i18n(key, [String(diff.hours())]); - } else if (diff.minutes() >= 1) { - const key = extended ? 'minutesAgo' : 'minutesAgoShort'; - - return i18n(key, [String(diff.minutes())]); } - return i18n('justNow'); + return timestamp.format(formats.d); }