diff options
Diffstat (limited to 'django')
-rw-r--r-- | django/utils/timesince.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/utils/timesince.py b/django/utils/timesince.py index 7a79e55ad9..94ba24d48a 100644 --- a/django/utils/timesince.py +++ b/django/utils/timesince.py @@ -77,7 +77,8 @@ def timesince(d, now=None, reversed=False, time_strings=None, depth=2): # Get years and months. total_months = (now.year - d.year) * 12 + (now.month - d.month) - if d.day > now.day or (d.day == now.day and d.time() > now.time()): + time_delta = delta - datetime.timedelta(days=delta.days) + if d.day > now.day or (d.day == now.day and time_delta.total_seconds() < 0): total_months -= 1 years, months = divmod(total_months, 12) |