Skip to content

Commit

Permalink
Fixed #29931 -- Removed unused ValueError handling in naturalday temp…
Browse files Browse the repository at this point in the history
…late tag.
  • Loading branch information
hramezani authored and timgraham committed Nov 9, 2018
1 parent 9b110f0 commit f62cf22
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions django/contrib/humanize/templatetags/humanize.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,12 @@ def naturalday(value, arg=None):
present day return representing string. Otherwise, return a string
formatted according to settings.DATE_FORMAT.
"""
tzinfo = getattr(value, 'tzinfo', None)
try:
tzinfo = getattr(value, 'tzinfo', None)
value = date(value.year, value.month, value.day)
except AttributeError:
# Passed value wasn't a date object
return value
except ValueError:
# Date arguments out of range
return value
today = datetime.now(tzinfo).date()
delta = value - today
if delta.days == 0:
Expand Down

0 comments on commit f62cf22

Please sign in to comment.