From f62cf22c48c1aa1badffd675a360e87d5d3ddb23 Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Thu, 8 Nov 2018 20:02:00 +0100 Subject: [PATCH] Fixed #29931 -- Removed unused ValueError handling in naturalday template tag. --- django/contrib/humanize/templatetags/humanize.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/django/contrib/humanize/templatetags/humanize.py b/django/contrib/humanize/templatetags/humanize.py index 6095813b069..194c7e8fbbc 100644 --- a/django/contrib/humanize/templatetags/humanize.py +++ b/django/contrib/humanize/templatetags/humanize.py @@ -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: