Skip to content

Commit

Permalink
fix: offset-aware time when preparing tasks (#2271)
Browse files Browse the repository at this point in the history
* fix: offset-aware time when preparing tasks

* chore: add changelog entry
  • Loading branch information
Dorukyum authored Nov 30, 2023
1 parent 7b77e09 commit 9b4f15a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ These changes are available on the `master` branch, but have not yet been releas
([#2113](https://github.com/Pycord-Development/pycord/issues/2113))
- Fixed `Option` not working on bridge commands because `ext.commands.Command` doesn't
recognize them. ([#2256](https://github.com/Pycord-Development/pycord/pull/2256))
- Fixed offset-aware tasks causing `TypeError` when being prepared.
([#2271](https://github.com/Pycord-Development/pycord/pull/2271))

## [2.4.1] - 2023-03-20

Expand Down
4 changes: 2 additions & 2 deletions discord/ext/tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,9 +619,9 @@ def _prepare_time_index(self, now: datetime.datetime = MISSING) -> None:
now
if now is not MISSING
else datetime.datetime.now(datetime.timezone.utc).replace(microsecond=0)
).timetz()
)
for idx, time in enumerate(self._time):
if time >= time_now:
if time >= time_now.astimezone(time.tzinfo).timetz():
self._time_index = idx
break
else:
Expand Down

0 comments on commit 9b4f15a

Please sign in to comment.