Fix week name display in chats list.

Fixes #25625.
This commit is contained in:
John Preston 2022-12-29 10:26:22 +04:00
parent 599cc35e57
commit be8aeb0d96
1 changed files with 3 additions and 5 deletions

View File

@ -89,12 +89,10 @@ void PaintRowDate(
const auto lastDate = lastTime.date();
const auto dt = [&] {
const auto wasSameDay = (lastDate == nowDate);
const auto wasRecently = qAbs(lastTime.secsTo(now)) < kRecentlyInSeconds;
if (wasSameDay || wasRecently) {
if ((lastDate == nowDate)
|| (qAbs(lastTime.secsTo(now)) < kRecentlyInSeconds)) {
return QLocale().toString(lastTime.time(), QLocale::ShortFormat);
} else if (lastDate.year() == nowDate.year()
&& lastDate.weekNumber() == nowDate.weekNumber()) {
} else if (qAbs(lastDate.daysTo(nowDate)) < 7) {
return langDayOfWeek(lastDate);
} else {
return QLocale().toString(lastDate, QLocale::ShortFormat);