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 lastDate = lastTime.date();
const auto dt = [&] { const auto dt = [&] {
const auto wasSameDay = (lastDate == nowDate); if ((lastDate == nowDate)
const auto wasRecently = qAbs(lastTime.secsTo(now)) < kRecentlyInSeconds; || (qAbs(lastTime.secsTo(now)) < kRecentlyInSeconds)) {
if (wasSameDay || wasRecently) {
return QLocale().toString(lastTime.time(), QLocale::ShortFormat); return QLocale().toString(lastTime.time(), QLocale::ShortFormat);
} else if (lastDate.year() == nowDate.year() } else if (qAbs(lastDate.daysTo(nowDate)) < 7) {
&& lastDate.weekNumber() == nowDate.weekNumber()) {
return langDayOfWeek(lastDate); return langDayOfWeek(lastDate);
} else { } else {
return QLocale().toString(lastDate, QLocale::ShortFormat); return QLocale().toString(lastDate, QLocale::ShortFormat);