fix: standardize UTC timestamp handling
This commit is contained in:
+2
-3
@@ -1,7 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from datetime import datetime
|
||||
|
||||
from flask import Flask, abort, jsonify, request
|
||||
|
||||
@@ -10,7 +9,7 @@ from .extensions import db, login_manager
|
||||
from .models import AppSetting, User
|
||||
from .prediction import FEATURES, load_model
|
||||
from .security import csrf_token, validate_csrf_token
|
||||
from .time_utils import format_datetime_for_timezone
|
||||
from .time_utils import current_year_for_timezone, format_datetime_for_timezone
|
||||
|
||||
|
||||
def create_app(config_object: type[Config] = Config, *, load_model_on_start: bool = True) -> Flask:
|
||||
@@ -90,7 +89,7 @@ def register_app_hooks(app: Flask) -> None:
|
||||
@app.context_processor
|
||||
def inject_helpers():
|
||||
def now_year() -> int:
|
||||
return datetime.now().year
|
||||
return current_year_for_timezone(app.config["APP_TIMEZONE"])
|
||||
|
||||
def format_datetime(value) -> str:
|
||||
return format_datetime_for_timezone(value, app.config["APP_TIMEZONE"])
|
||||
|
||||
Reference in New Issue
Block a user