Skip to content

Commit

Permalink
Further refinements to the Conversations panel timestamps.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ianmacd committed Jul 18, 2023
1 parent 44a6056 commit a8c4e01
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ts/components/conversation/Timestamp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,13 @@ export const Timestamp = (props: Props) => {
// Today: Use the time only.
dateString = momentValue.format('LT');
} else if (now.diff(momentValue, 'days') < 6) {
// Less than a week old: Use the day only.
dateString = momentValue.format('ddd');
// Less than a week old: Use the day and time.
dateString = momentValue.format('ddd LT');
} else if (momentValue.isSame(now, 'year')) {
// This year: Use the month, day of month and time.
dateString = momentValue.format('MMM D LT');
} else {
// More than a week old: Use the full date.
// Last year or older: Use the full date.
dateString = momentValue.format('L');
}
} else {
Expand Down

0 comments on commit a8c4e01

Please sign in to comment.