mirror of
https://github.com/paul-nameless/tg
synced 2024-11-22 03:43:19 +00:00
Display shorter date in chats (#109)
This commit is contained in:
parent
9224de4110
commit
5b53495b60
1 changed files with 6 additions and 3 deletions
|
@ -552,11 +552,14 @@ def get_last_msg(chat: Dict[str, Any]) -> Tuple[Optional[int], str]:
|
|||
def get_date(chat: Dict[str, Any]) -> str:
|
||||
last_msg = chat.get("last_message")
|
||||
if not last_msg:
|
||||
return "<NA>"
|
||||
return "<No date>"
|
||||
dt = datetime.fromtimestamp(last_msg["date"])
|
||||
date_fmt = "%d %b %y"
|
||||
if datetime.today().date() == dt.date():
|
||||
return dt.strftime("%H:%M")
|
||||
return dt.strftime("%d %b %y")
|
||||
date_fmt = "%H:%M"
|
||||
elif datetime.today().year == dt.year:
|
||||
date_fmt = "%d %b"
|
||||
return dt.strftime(date_fmt)
|
||||
|
||||
|
||||
def parse_content(content: Dict[str, Any]) -> str:
|
||||
|
|
Loading…
Reference in a new issue