From 48686a9864f8eea4af33bbbe77a1256e5951de67 Mon Sep 17 00:00:00 2001 From: Dan Trickey Date: Thu, 3 Oct 2024 17:37:29 +0100 Subject: [PATCH] Fix timezone bug --- kmibot/modules/pub/commands.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kmibot/modules/pub/commands.py b/kmibot/modules/pub/commands.py index ea1f79a..b550d3c 100644 --- a/kmibot/modules/pub/commands.py +++ b/kmibot/modules/pub/commands.py @@ -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: @@ -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, ],