Fix date delta display for deltas greater than 1 year (#1099)

This commit is contained in:
Ian Beringer 2017-02-16 00:24:32 +01:00 committed by Joshua Tauberer
parent 36bef2ee16
commit 89222d519a
1 changed files with 2 additions and 0 deletions

View File

@ -39,6 +39,8 @@ def backup_status(env):
def reldate(date, ref, clip):
if ref < date: return clip
rd = dateutil.relativedelta.relativedelta(ref, date)
if rd.years > 1: return "%d years, %d months" % (rd.years, rd.months)
if rd.years == 1: return "%d year, %d months" % (rd.years, rd.months)
if rd.months > 1: return "%d months, %d days" % (rd.months, rd.days)
if rd.months == 1: return "%d month, %d days" % (rd.months, rd.days)
if rd.days >= 7: return "%d days" % rd.days