fixed timedelta thing

This commit is contained in:
osmarks 2020-10-30 12:49:17 +00:00
parent 0ef9aaa8c3
commit fd4585a12f
1 changed files with 3 additions and 2 deletions

View File

@ -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 = "^[^`]*`(.*)`$"