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.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 typing import List
|
||||||
from app.core.models.chat_models import PrivateChatListItem
|
from app.core.models.chat_models import PrivateChatListItem
|
||||||
from app.ui.widgets.chat_list_item_widget import ChatListItemWidget
|
from app.ui.widgets.chat_list_item_widget import ChatListItemWidget
|
||||||
@ -175,6 +175,13 @@ class ChatListView(QWidget):
|
|||||||
now = datetime.now().astimezone()
|
now = datetime.now().astimezone()
|
||||||
delta_days = (now.date() - ts_dt.date()).days
|
delta_days = (now.date() - ts_dt.date()).days
|
||||||
if delta_days == 0:
|
if delta_days == 0:
|
||||||
|
# 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')
|
display_ts = ts_dt.strftime('%H:%M')
|
||||||
elif delta_days == 1:
|
elif delta_days == 1:
|
||||||
display_ts = 'Вчера'
|
display_ts = 'Вчера'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user