New Database

This commit is contained in:
喆OvO
2026-08-11 22:07:55 +08:00
parent cbbb2e6d34
commit ceb4404c6a
28 changed files with 1825 additions and 768 deletions
+2 -3
View File
@@ -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