diff options
| author | 2021-10-22 21:45:52 +0100 | |
|---|---|---|
| committer | 2021-10-22 21:45:52 +0100 | |
| commit | bb0018048ea7ec83abe7a34df263aa0ebb29fecd (patch) | |
| tree | 9c2b67e75e466da5f9ed6505d489ac642a868fd6 | |
| parent | Move to timezone aware datetimes (#1895) (diff) | |
Use Arrow.fromtimestamp to get an aware datetime
Fixes #1905
Fixes BOT-1P9
datetime.fromtimestamp returned an naive datetime, so when comparing to the aware datetime from dateutil.parser.isoparse, it would raise an error.
Diffstat (limited to '')
| -rw-r--r-- | bot/exts/moderation/infraction/management.py | 4 | 
1 files changed, 2 insertions, 2 deletions
| diff --git a/bot/exts/moderation/infraction/management.py b/bot/exts/moderation/infraction/management.py index 96c818c47..eaaa1e00b 100644 --- a/bot/exts/moderation/infraction/management.py +++ b/bot/exts/moderation/infraction/management.py @@ -1,9 +1,9 @@  import textwrap  import typing as t -from datetime import datetime  import dateutil.parser  import discord +from arrow import Arrow  from dateutil.relativedelta import relativedelta  from discord.ext import commands  from discord.ext.commands import Context @@ -314,7 +314,7 @@ class ModManagement(commands.Cog):          if expires_at is None:              duration = "*Permanent*"          else: -            date_from = datetime.fromtimestamp(float(time.DISCORD_TIMESTAMP_REGEX.match(created).group(1))) +            date_from = Arrow.fromtimestamp(float(time.DISCORD_TIMESTAMP_REGEX.match(created).group(1)))              date_to = dateutil.parser.isoparse(expires_at)              duration = humanize_delta(relativedelta(date_to, date_from)) | 
