fix timezone bug
This commit is contained in:
13
app.py
13
app.py
@@ -66,6 +66,19 @@ app.register_blueprint(upload_bp)
|
||||
app.register_blueprint(admin_bp)
|
||||
app.register_blueprint(api_bp)
|
||||
|
||||
# 註冊自訂模板 filter
|
||||
from utils.timezone import format_taiwan_time
|
||||
|
||||
@app.template_filter('taiwan_time')
|
||||
def taiwan_time_filter(dt, format_str='%Y-%m-%d %H:%M:%S'):
|
||||
"""將 datetime 轉換為台灣時間格式字符串"""
|
||||
return format_taiwan_time(dt, format_str)
|
||||
|
||||
@app.template_filter('taiwan_date')
|
||||
def taiwan_date_filter(dt):
|
||||
"""將 datetime 轉換為台灣日期格式字符串"""
|
||||
return format_taiwan_time(dt, '%Y-%m-%d')
|
||||
|
||||
# 導入任務
|
||||
from tasks import check_expiring_specs
|
||||
|
||||
|
Reference in New Issue
Block a user