Commit 8310b029 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Pass date object directly to arrow for consistent humanized dates

With the previous method of using arrow, the same date object would
result in different humanized dates. Apparently using now() and then
replacing the date components triggers some inaccuracy.

Simplify the call to arrow by passing it the datetime object directly.
parent c9e1cd0d
......@@ -113,7 +113,5 @@ def translate_key_to_config(p_key):
def humanize_date(p_datetime):
""" Returns a relative date string from a datetime object. """
now = arrow.now()
date = now.replace(day=p_datetime.day, month=p_datetime.month, year=p_datetime.year)
return date.humanize().replace('just now', 'today')
return arrow.get(p_datetime).humanize().replace('just now', 'today')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment