chat patch
This commit is contained in:
parent
a9fb3df4ec
commit
4e50ff865f
@ -1,5 +1,5 @@
|
||||
from PySide6.QtWidgets import QWidget, QListWidget, QVBoxLayout, QListWidgetItem, QAbstractItemView
|
||||
from PySide6.QtCore import Qt, QSize, Signal
|
||||
from PySide6.QtCore import Qt, QSize, Signal, QLocale
|
||||
from typing import List
|
||||
from app.core.models.chat_models import PrivateChatListItem
|
||||
from app.ui.widgets.chat_list_item_widget import ChatListItemWidget
|
||||
@ -175,7 +175,14 @@ class ChatListView(QWidget):
|
||||
now = datetime.now().astimezone()
|
||||
delta_days = (now.date() - ts_dt.date()).days
|
||||
if delta_days == 0:
|
||||
display_ts = ts_dt.strftime('%H:%M')
|
||||
# Respect system 12/24h preference
|
||||
time_fmt = QLocale.system().timeFormat(QLocale.ShortFormat)
|
||||
if ('AP' in time_fmt) or ('ap' in time_fmt) or ('a' in time_fmt):
|
||||
# 12-hour clock
|
||||
display_ts = ts_dt.strftime('%I:%M %p').lstrip('0')
|
||||
else:
|
||||
# 24-hour clock
|
||||
display_ts = ts_dt.strftime('%H:%M')
|
||||
elif delta_days == 1:
|
||||
display_ts = 'Вчера'
|
||||
elif 1 < delta_days < 7:
|
||||
|
||||
Reference in New Issue
Block a user