diff options
| author | Rapptz <[email protected]> | 2021-06-28 00:37:16 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2021-06-28 00:37:16 -0400 |
| commit | 4566b64d77d638505a0931b560606694b5e2c9f3 (patch) | |
| tree | e112665fc9528cd2dc0962f3109c967652d4b736 /discord/activity.py | |
| parent | Rework Message.edit implementation (diff) | |
| download | discord.py-4566b64d77d638505a0931b560606694b5e2c9f3.tar.xz discord.py-4566b64d77d638505a0931b560606694b5e2c9f3.zip | |
Fix Activity and Spotify datetime being timezone naive
Diffstat (limited to 'discord/activity.py')
| -rw-r--r-- | discord/activity.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/discord/activity.py b/discord/activity.py index 5973290d..72552ec7 100644 --- a/discord/activity.py +++ b/discord/activity.py @@ -130,7 +130,7 @@ class BaseActivity: .. versionadded:: 1.3 """ if self._created_at is not None: - return datetime.datetime.utcfromtimestamp(self._created_at / 1000) + return datetime.datetime.utcfromtimestamp(self._created_at / 1000).replace(tzinfo=datetime.timezone.utc) class Activity(BaseActivity): @@ -583,7 +583,7 @@ class Spotify: .. versionadded:: 1.3 """ if self._created_at is not None: - return datetime.datetime.utcfromtimestamp(self._created_at / 1000) + return datetime.datetime.utcfromtimestamp(self._created_at / 1000).replace(tzinfo=datetime.timezone.utc) @property def colour(self): @@ -686,12 +686,12 @@ class Spotify: @property def start(self): """:class:`datetime.datetime`: When the user started playing this song in UTC.""" - return datetime.datetime.utcfromtimestamp(self._timestamps['start'] / 1000) + return datetime.datetime.utcfromtimestamp(self._timestamps['start'] / 1000).replace(tzinfo=datetime.timezone.utc) @property def end(self): """:class:`datetime.datetime`: When the user will stop playing this song in UTC.""" - return datetime.datetime.utcfromtimestamp(self._timestamps['end'] / 1000) + return datetime.datetime.utcfromtimestamp(self._timestamps['end'] / 1000).replace(tzinfo=datetime.timezone.utc) @property def duration(self): |