1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-12-22 07:17:05 +00:00

backup status relativedelta was displaying wrong for deltas greater than 1 month

This commit is contained in:
Joshua Tauberer 2014-10-05 18:23:18 +00:00
parent 711db9352c
commit 4cf53cd8ee

View File

@ -27,6 +27,8 @@ def backup_status(env):
now = datetime.datetime.now(dateutil.tz.tzlocal())
def reldate(date, ref):
rd = dateutil.relativedelta.relativedelta(ref, date)
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
if rd.days > 1: return "%d days, %d hours" % (rd.days, rd.hours)
if rd.days == 1: return "%d day, %d hours" % (rd.days, rd.hours)