Skip to content
This repository was archived by the owner on Oct 30, 2025. It is now read-only.

Commit 7d16b74

Browse files
committed
Further refinements to the Conversations panel timestamps.
See #2707 (comment) for the discussion. * If the conversation last received a message today, just the time of the message is used, e.g. 12:03. * If the conversation last received a message in the last week, the day and time of the message are used, e.g. Mon 12:03. * If the conversation last received a message this calendar year, the month, day of month and time of the message are used, e.g. Mar 13 12:03. * If the conversation last received a message in a previous calendar year, the date of the message is used, e.g. 13/03/2023.
1 parent 5eea754 commit 7d16b74

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ts/components/conversation/Timestamp.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,13 @@ export const Timestamp = (props: Props) => {
5858
// Today: Use the time only.
5959
dateString = momentValue.format('LT');
6060
} else if (now.diff(momentValue, 'days') < 6) {
61-
// Less than a week old: Use the day only.
62-
dateString = momentValue.format('ddd');
61+
// Less than a week old: Use the day and time.
62+
dateString = momentValue.format('ddd LT');
63+
} else if (momentValue.isSame(now, 'year')) {
64+
// This year: Use the month, day of month and time.
65+
dateString = momentValue.format('MMM D LT');
6366
} else {
64-
// More than a week old: Use the full date.
67+
// Last year or older: Use the full date.
6568
dateString = momentValue.format('L');
6669
}
6770
} else {

0 commit comments

Comments
 (0)