From fd4585a12f36557edc4a2e27c8cfb5e11c28632c Mon Sep 17 00:00:00 2001 From: osmarks Date: Fri, 30 Oct 2020 12:49:17 +0000 Subject: [PATCH] fixed timedelta thing --- src/util.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util.py b/src/util.py index 671296b..38350bc 100644 --- a/src/util.py +++ b/src/util.py @@ -72,17 +72,18 @@ timeparts = ( ("y", "years"), ("mo", "months"), ("d", "days"), + ("h", "hours"), ("m", "minutes"), ("s", "seconds") ) def format_timedelta(from_, to): d = relativedelta(to, from_) - out = "0s" if d.seconds == 0 else "" + out = "" for short, attr in timeparts: x = getattr(d, attr) if x != 0: out += str(x) + short - return out + return "0s" if out == "" else out CODEBLOCK_REGEX = "^[^`]*```[a-zA-Z0-9_\-+]*\n(.+)```$" CODELINE_REGEX = "^[^`]*`(.*)`$"