Skip to content

Commit

Permalink
Fix localize
Browse files Browse the repository at this point in the history
  • Loading branch information
AndersSeverinsen committed Oct 18, 2024
1 parent 6d1b8ca commit 26b6755
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 2 additions & 3 deletions bartenders/management/commands/generate_barshifts.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,8 @@ def handle(self, *args, **options):
second_start_naive = datetime.datetime.combine(
shift_start.date(), DOUBLE_SECOND_SHIFT_START
)
second_start = timezone.get_default_timezone().localize(
second_start_naive
)
tz = timezone.get_current_timezone()
second_start = timezone.make_aware(second_start_naive, tz)
second_end = second_start + DOUBLE_SECOND_SHIFT_DURATION

shift_periods[-1] = (shift_start, second_start)
Expand Down
5 changes: 3 additions & 2 deletions bartenders/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,9 @@ def with_bartender(self, bartender):
)

def has_multiple_shifts(self):
start = timezone.get_default_timezone().localize(
datetime.datetime.combine(self.date, datetime.time())
tz = timezone.get_current_timezone()
start = timezone.make_aware(
datetime.datetime.combine(self.date, datetime.time()), tz
)
end = start + datetime.timedelta(days=1)
return (
Expand Down

0 comments on commit 26b6755

Please sign in to comment.