i bliggleblorfed

This commit is contained in:
2026-02-16 14:00:18 -06:00
parent c693572069
commit 832c1e1a23

View File

@@ -25,11 +25,11 @@ def _get_nearest_scheduled_time(times, user_tz=None):
# Default to UTC if no timezone provided # Default to UTC if no timezone provided
user_tz = timezone.utc user_tz = timezone.utc
elif isinstance(user_tz, int): elif isinstance(user_tz, int):
# If user_tz is an offset in minutes, convert to timezone object # If user_tz is an offset in minutes, convert to timezone object.
# Positive offset means behind UTC, so we need to use Etc/GMT+N # The int format is: positive = behind UTC (e.g. 480 = UTC-8).
# where N = -offset_minutes/60 (because Etc/GMT+5 means 5 hours behind UTC) # Python's timezone offset is: positive = ahead of UTC.
offset_hours = -user_tz // 60 # So we negate the input to get the correct standard offset.
user_tz = pytz.timezone(f"Etc/GMT+{offset_hours}") user_tz = timezone(timedelta(minutes=-user_tz))
now = datetime.now(user_tz) now = datetime.now(user_tz)
now_minutes = now.hour * 60 + now.minute now_minutes = now.hour * 60 + now.minute