Fix time format Windows does not support. Resolve #1881. Resolve #1880

This commit is contained in:
Griatch 2019-08-29 00:10:46 +02:00
parent 71840a14d3
commit 18a09e341c
3 changed files with 25 additions and 6 deletions

View file

@ -577,10 +577,10 @@ def datetime_format(dtobj):
if dtobj.year < now.year:
# another year (Apr 5, 2019)
timestring = dtobj.strftime("%b %-d, %Y")
timestring = dtobj.strftime(f"%b {dtobj.day}, %Y")
elif dtobj.date() < now.date():
# another date, same year (Apr 5)
timestring = dtobj.strftime("%b %-d")
timestring = dtobj.strftime(f"%b {dtobj.day}")
elif dtobj.hour < now.hour - 1:
# same day, more than 1 hour ago (10:45)
timestring = dtobj.strftime("%H:%M")