From aa2a7acaf1ad6b078812b8b163bd6239f2e45c31 Mon Sep 17 00:00:00 2001 From: wangqifan Date: Sat, 29 Nov 2025 22:40:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/__init__.py | 2 +- app/config.py | 2 ++ app/templates/apis/list.html | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) 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 @@ 编辑 + 查看日志