Trying to fix profile dashboard timestamps.
This commit is contained in:
@@ -17,6 +17,18 @@ app = FastAPI(
|
||||
# Define templates EARLY (before importing dashboard)
|
||||
templates = Jinja2Templates(directory=BASE_DIR / "templates")
|
||||
|
||||
from datetime import datetime, timezone
|
||||
|
||||
@templates.env.filters.register
|
||||
def timestamp_to_date(ts):
|
||||
if ts is None:
|
||||
return "Never"
|
||||
try:
|
||||
dt = datetime.fromtimestamp(float(ts), tz=timezone.utc)
|
||||
return dt.strftime("%Y-%m-%d %H:%M:%S UTC")
|
||||
except (ValueError, TypeError):
|
||||
return "Invalid"
|
||||
|
||||
# Static files
|
||||
app.mount("/static", StaticFiles(directory=BASE_DIR / "static"), name="static")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user