Skip to content

Commit ecd7255

Browse files
Merge pull request #1906 from python-discord/fix-tzinfo-issue
Use Arrow.fromtimestamp to get an aware datetime
2 parents 913b1d5 + bb00180 commit ecd7255

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bot/exts/moderation/infraction/management.py

Lines changed: 2 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
43

54
import dateutil.parser
65
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,7 @@ 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 = datetime.fromtimestamp(float(time.DISCORD_TIMESTAMP_REGEX.match(created).group(1)))
317+
date_from = Arrow.fromtimestamp(float(time.DISCORD_TIMESTAMP_REGEX.match(created).group(1)))
318318
date_to = dateutil.parser.isoparse(expires_at)
319319
duration = humanize_delta(relativedelta(date_to, date_from))
320320

0 commit comments

Comments
 (0)