mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-16 20:49:00 -04:00
Merge pull request #1291 from alphagov/two-way
Add page to show two-way conversation
This commit is contained in:
@@ -257,13 +257,20 @@ def format_datetime_relative(date):
|
||||
|
||||
|
||||
def get_human_day(time):
|
||||
|
||||
# Add 1 hour to get ‘midnight today’ instead of ‘midnight tomorrow’
|
||||
time = (gmt_timezones(time) - timedelta(hours=1)).strftime('%A')
|
||||
if time == datetime.utcnow().strftime('%A'):
|
||||
return 'today'
|
||||
if time == (datetime.utcnow() + timedelta(days=1)).strftime('%A'):
|
||||
time_as_day = (gmt_timezones(time) - timedelta(hours=1)).strftime('%A')
|
||||
six_days_ago = gmt_timezones((datetime.utcnow() + timedelta(days=-6)).isoformat())
|
||||
|
||||
if gmt_timezones(time) < six_days_ago:
|
||||
return format_date_short(time)
|
||||
if time_as_day == (datetime.utcnow() + timedelta(days=1)).strftime('%A'):
|
||||
return 'tomorrow'
|
||||
return time
|
||||
if time_as_day == datetime.utcnow().strftime('%A'):
|
||||
return 'today'
|
||||
if time_as_day == (datetime.utcnow() + timedelta(days=-1)).strftime('%A'):
|
||||
return 'yesterday'
|
||||
return format_date_short(time)
|
||||
|
||||
|
||||
def format_time(date):
|
||||
|
||||
Reference in New Issue
Block a user