mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-18 21:49:37 -04:00
Add years to old dates
Just to disambiguate things without introducing unnecessary noise.
This commit is contained in:
@@ -297,12 +297,16 @@ def get_human_day(time):
|
||||
|
||||
# Add 1 minute to transform 00:00 into ‘midnight today’ instead of ‘midnight tomorrow’
|
||||
date = (utc_string_to_aware_gmt_datetime(time) - timedelta(minutes=1)).date()
|
||||
if date == (datetime.utcnow() + timedelta(days=1)).date():
|
||||
now = datetime.utcnow()
|
||||
|
||||
if date == (now + timedelta(days=1)).date():
|
||||
return 'tomorrow'
|
||||
if date == datetime.utcnow().date():
|
||||
if date == now.date():
|
||||
return 'today'
|
||||
if date == (datetime.utcnow() - timedelta(days=1)).date():
|
||||
if date == (now - timedelta(days=1)).date():
|
||||
return 'yesterday'
|
||||
if date.strftime('%Y') != now.strftime('%Y'):
|
||||
return '{} {}'.format(_format_datetime_short(date), date.strftime('%Y'))
|
||||
return _format_datetime_short(date)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user