Skip to content

Commit 6a6425b

Browse files
committed
Further refinements to the Conversations panel timestamps.
See oxen-io#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 533293b commit 6a6425b

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
@@ -53,10 +53,13 @@ export const Timestamp = (props: Props) => {
5353
// Today: Use the time only.
5454
dateString = momentValue.format('LT');
5555
} else if (now.diff(momentValue, 'days') < 6) {
56-
// Less than a week old: Use the day only.
57-
dateString = momentValue.format('ddd');
56+
// Less than a week old: Use the day and time.
57+
dateString = momentValue.format('ddd LT');
58+
} else if (momentValue.isSame(now, 'year')) {
59+
// This year: Use the month, day of month and time.
60+
dateString = momentValue.format('MMM D LT');
5861
} else {
59-
// More than a week old: Use the full date.
62+
// Last year or older: Use the full date.
6063
dateString = momentValue.format('L');
6164
}
6265
} else {

0 commit comments

Comments
 (0)