mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-31 21:41:33 +00:00
Treat 12:00am as occurring at the start of the day
Otherwise a story published at midnight today is displayed as "Yesterday, 12:00am".
This commit is contained in:
parent
a79d0fa6be
commit
4b84eddcd6
1 changed files with 5 additions and 5 deletions
|
@ -35,9 +35,9 @@ def format_story_link_date__short(date, now=None):
|
|||
now = datetime.datetime.now()
|
||||
date = date.replace(tzinfo=None)
|
||||
midnight = midnight_today(now)
|
||||
if date > midnight:
|
||||
if date >= midnight:
|
||||
return date.strftime('%I:%M%p').lstrip('0').lower()
|
||||
elif date > midnight_yesterday(midnight):
|
||||
elif date >= midnight_yesterday(midnight):
|
||||
return 'Yesterday, ' + date.strftime('%I:%M%p').lstrip('0').lower()
|
||||
else:
|
||||
return date.strftime('%d %b %Y, ') + date.strftime('%I:%M%p').lstrip('0').lower()
|
||||
|
@ -49,11 +49,11 @@ def format_story_link_date__long(date, now=None):
|
|||
midnight = midnight_today()
|
||||
parsed_date = DateFormat(date)
|
||||
|
||||
if date > midnight:
|
||||
if date >= midnight:
|
||||
return 'Today, ' + parsed_date.format('F jS ') + date.strftime('%I:%M%p').lstrip('0').lower()
|
||||
elif date > midnight_yesterday(midnight):
|
||||
elif date >= midnight_yesterday(midnight):
|
||||
return 'Yesterday, ' + parsed_date.format('F jS g:ia').replace('.','')
|
||||
elif date > beginning_of_this_month():
|
||||
elif date >= beginning_of_this_month():
|
||||
return parsed_date.format('l, F jS g:ia').replace('.','')
|
||||
else:
|
||||
return parsed_date.format('l, F jS, Y g:ia').replace('.','')
|
||||
|
|
Loading…
Add table
Reference in a new issue