fix: chats from the last day of a month show under Previous 7 days on the first (#31973)

On the first day of a month, chats from the day before were listed under "Previous 7 days" in the sidebar instead of "Yesterday". The same happened on January 1st for chats from December 31st. Any chat from the previous calendar day is now listed under "Yesterday", whatever the month or year.

Fixes #31964
This commit is contained in:
Classic298 2026-10-07 14:23:02 +02:00 • committed by GitHub
parent 806644fcba
commit 5079890442
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1335,7 +1335,7 @@ export const getTimeRange = (timestamp) => {
if (nowYear === dateYear && nowMonth === dateMonth && nowDate === dateDate) {
return 'Today';
} else if (nowYear === dateYear && nowMonth === dateMonth && nowDate - dateDate === 1) {
} else if (dayjs(date).isYesterday()) {
return 'Yesterday';
} else if (diffDays <= 7) {
return 'Previous 7 days';