diff --git a/app/__init__.py b/app/__init__.py index eab2e5d..3db0e95 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -106,7 +106,7 @@ def register_template_filters(app: Flask) -> None: if not dt: return "" try: - tz = ZoneInfo(app.config.get("SCHEDULER_TIMEZONE", "Asia/Shanghai")) + tz = ZoneInfo(app.config.get("DISPLAY_TIMEZONE", "Asia/Shanghai")) # 如果是 naive datetime,认为是 UTC if dt.tzinfo is None: dt = dt.replace(tzinfo=ZoneInfo("UTC")) diff --git a/app/config.py b/app/config.py index 47f9e6c..29e75d7 100644 --- a/app/config.py +++ b/app/config.py @@ -19,6 +19,8 @@ class BaseConfig: SCHEDULER_API_ENABLED = False # 默认采用中国标准时间,可通过环境变量 APP_TIMEZONE 覆盖 SCHEDULER_TIMEZONE = os.getenv("APP_TIMEZONE", "Asia/Shanghai") + # 页面展示时间的时区,默认中国标准时间,可用 DISPLAY_TIMEZONE 覆盖 + DISPLAY_TIMEZONE = os.getenv("DISPLAY_TIMEZONE", "Asia/Shanghai") ENABLE_SCHEDULER = True diff --git a/app/templates/apis/list.html b/app/templates/apis/list.html index 2cf045f..b70c130 100644 --- a/app/templates/apis/list.html +++ b/app/templates/apis/list.html @@ -50,6 +50,7 @@ 编辑 + 查看日志