From 4cf53cd8ee11227d0185aba61649baa087bc01c7 Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Sun, 5 Oct 2014 18:23:18 +0000 Subject: [PATCH] backup status relativedelta was displaying wrong for deltas greater than 1 month --- management/backup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/management/backup.py b/management/backup.py index 513ead24..47259c3b 100755 --- a/management/backup.py +++ b/management/backup.py @@ -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)