diff --git a/matrix_reminder_bot/bot_commands.py b/matrix_reminder_bot/bot_commands.py index 877ec87..07332a5 100644 --- a/matrix_reminder_bot/bot_commands.py +++ b/matrix_reminder_bot/bot_commands.py @@ -65,7 +65,10 @@ def _parse_str_to_time(time_str: str, tz_aware: bool = True) -> datetime: # Disallow times in the past tzinfo = pytz.timezone(CONFIG.timezone) - if tzinfo.localize(time) < _get_datetime_now(CONFIG.timezone): + local_time = time + if not tz_aware: + local_time = tzinfo.localize(time) + if local_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