Skip to content

Commit

Permalink
Fix timezone bug
Browse files Browse the repository at this point in the history
  • Loading branch information
trickeydan committed Oct 3, 2024
1 parent 397ae15 commit 48686a9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions kmibot/modules/pub/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,10 @@ async def change(self, interaction: discord.Interaction) -> None: # noqa: A003
)
return

local_pub_time = scheduled_event.start_time.astimezone(self.config.timezone)
pub = await self._choose_pub(
interaction,
f"Please choose the new pub for {scheduled_event.start_time}",
f"Please choose the new pub for {local_pub_time}",
)

if pub.id == original_pub_event.pub:
Expand Down Expand Up @@ -202,11 +203,11 @@ async def change(self, interaction: discord.Interaction) -> None: # noqa: A003
# Nobody to tag if we don't have a pub event.
tags = ""

if scheduled_event.start_time >= datetime.now(tz=self.config.timezone):
if scheduled_event.start_time < datetime.now(tz=self.config.timezone):
content = "\n".join(
[
"**Pub has moved!**",
f"The pub will be at {formatted_pub_name} instead!",
f"The pub at will be at {formatted_pub_name} instead!",
"",
tags,
],
Expand Down

0 comments on commit 48686a9

Please sign in to comment.