New Database
This commit is contained in:
@@ -15,7 +15,6 @@ The timezone is cached per-request via Flask app config to avoid DB lookups.
|
||||
import time as _time
|
||||
import threading
|
||||
from datetime import datetime, timedelta, timezone, date
|
||||
from typing import Union
|
||||
|
||||
import pytz
|
||||
|
||||
@@ -130,14 +129,14 @@ def set_tz(tz_str: str) -> bool:
|
||||
# Convert to an IANA-like name: pytz has FixedOffset but easiest is
|
||||
# just use a fixed-offset timezone
|
||||
import pytz
|
||||
tz = pytz.FixedOffset(sign * hours * 60) # FixedOffset expects minutes
|
||||
pytz.FixedOffset(sign * hours * 60) # FixedOffset expects minutes
|
||||
except (ValueError, IndexError):
|
||||
return False
|
||||
else:
|
||||
# IANA name — validate by trying to load
|
||||
try:
|
||||
import pytz
|
||||
tz = pytz.timezone(normalized)
|
||||
pytz.timezone(normalized)
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user