Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SijmenHuizenga committed Oct 23, 2023
1 parent e3c6b57 commit f85d9ff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions schedule/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ def _schedule_next_run(self) -> None:

self.next_run = self.next_run.replace(**kwargs) # type: ignore

if self.next_run.tzinfo:
if self.at_time_zone is not None:
# Sometimes when changing time we move into a different timezone (e.g. DST)
# To correct the timezone-element, we can 'normalize' the time.
self.next_run = self.at_time_zone.normalize(self.next_run)
Expand Down Expand Up @@ -792,7 +792,7 @@ def _schedule_next_run(self) -> None:

# Calculations happen in the configured timezone, but to execute the schedule we
# need to know the next_run time in the system time. So we convert back to naive local
if self.next_run.tzinfo:
if self.at_time_zone is not None:
self.next_run = self.at_time_zone.normalize(self.next_run)
self.next_run = self.next_run.astimezone().replace(tzinfo=None)

Expand Down

0 comments on commit f85d9ff

Please sign in to comment.