From e70c96248bd7b548412811a4f1ffe88bed41f815 Mon Sep 17 00:00:00 2001 From: Sebastiaan Zeeff <33516116+SebastiaanZ@users.noreply.github.com> Date: Thu, 19 Sep 2019 12:37:47 +0200 Subject: Fix date formatting bug in infraction search The infraction search feature did not work because of a small bug with the date formatting: `datetime.fromisoformat` does not like the Z at the end of the datestring the database sends back, so we need to chop it off. I've applied the same method for doing that as already in use in other parts of the bot codebase. --- bot/cogs/moderation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot/cogs/moderation.py b/bot/cogs/moderation.py index 2d6c40a46..fea86c33e 100644 --- a/bot/cogs/moderation.py +++ b/bot/cogs/moderation.py @@ -1260,11 +1260,11 @@ class Moderation(Scheduler, Cog): active = infraction_object["active"] user_id = infraction_object["user"] hidden = infraction_object["hidden"] - created = datetime.fromisoformat(infraction_object["inserted_at"]).strftime("%Y-%m-%d %H:%M") + created = datetime.fromisoformat(infraction_object["inserted_at"][:-1]).strftime("%Y-%m-%d %H:%M") if infraction_object["expires_at"] is None: expires = "*Permanent*" else: - expires = datetime.fromisoformat(infraction_object["expires_at"]).strftime("%Y-%m-%d %H:%M") + expires = datetime.fromisoformat(infraction_object["expires_at"][:-1]).strftime("%Y-%m-%d %H:%M") lines = textwrap.dedent(f""" {"**===============**" if active else "==============="} -- cgit v1.2.3