Skip to content

Commit 3b846ae

Browse files
Merge pull request #1908 from python-discord/fix-tz-issue
Use datetime.fromtimestamp so we pass relativedelta a datetime object…
2 parents ecd7255 + 22f155e commit 3b846ae

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

bot/exts/moderation/infraction/management.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import textwrap
22
import typing as t
3+
from datetime import datetime, timezone
34

45
import dateutil.parser
56
import discord
6-
from arrow import Arrow
77
from dateutil.relativedelta import relativedelta
88
from discord.ext import commands
99
from discord.ext.commands import Context
@@ -314,7 +314,10 @@ def infraction_to_string(self, infraction: t.Dict[str, t.Any]) -> str:
314314
if expires_at is None:
315315
duration = "*Permanent*"
316316
else:
317-
date_from = Arrow.fromtimestamp(float(time.DISCORD_TIMESTAMP_REGEX.match(created).group(1)))
317+
date_from = datetime.fromtimestamp(
318+
float(time.DISCORD_TIMESTAMP_REGEX.match(created).group(1)),
319+
timezone.utc
320+
)
318321
date_to = dateutil.parser.isoparse(expires_at)
319322
duration = humanize_delta(relativedelta(date_to, date_from))
320323

0 commit comments

Comments
 (0)