Skip to content

Commit

Permalink
Merge pull request #145 from anoadragon453/HarHarLinks/fix-127
Browse files Browse the repository at this point in the history
fix LMT issue #127
  • Loading branch information
HarHarLinks authored Feb 16, 2024
2 parents 4403816 + b77be18 commit ecff7bc
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions matrix_reminder_bot/bot_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def _parse_str_to_time(time_str: str, tz_aware: bool = True) -> datetime:

# Disallow times in the past
tzinfo = pytz.timezone(CONFIG.timezone)
if time.replace(tzinfo=tzinfo) < _get_datetime_now(CONFIG.timezone):
if tzinfo.localize(time) < _get_datetime_now(CONFIG.timezone):
raise CommandError(f"The given time '{time_str}' is in the past.")

# Round datetime object to the nearest second for nicer display
Expand Down Expand Up @@ -204,10 +204,8 @@ async def _confirm_reminder(self, reminder: Reminder):

return

# Convert a timedelta to a formatted time (ex. May 25 2020, 01:31)
start_time = reminder.start_time.replace(
tzinfo=pytz.timezone(reminder.timezone)
)
# Convert a datetime to a formatted time (ex. May 25 2020, 01:31)
start_time = pytz.timezone(reminder.timezone).localize(reminder.start_time)
human_readable_start_time = start_time.strftime("%b %d %Y, %H:%M")

# Get a textual representation of who will be notified by this reminder
Expand Down

0 comments on commit ecff7bc

Please sign in to comment.