aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Sebastiaan Zeeff <[email protected]>2019-09-19 12:37:47 +0200
committerGravatar Sebastiaan Zeeff <[email protected]>2019-09-19 12:37:47 +0200
commite70c96248bd7b548412811a4f1ffe88bed41f815 (patch)
treef2a68b4f1122d7a25d1a92a1d92613866a9f8e56
parentAdd tests for `bot.rules.attachments`. (#426) (diff)
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.
-rw-r--r--bot/cogs/moderation.py4
1 files 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 "==============="}