mirror of
https://github.com/escalante29/WealthySmart.git
synced 2026-07-17 11:28:47 +02:00
Replace deprecated datetime.utcnow with shared naive-UTC helper
All 29 call sites now use app.timeutil.utcnow(), which returns naive UTC via the non-deprecated API. Semantics are unchanged on purpose: every datetime column is TIMESTAMP WITHOUT TIME ZONE, so going aware here would poison naive/aware comparisons. The TIMESTAMPTZ migration (Phase 2) now has a single place to change. (BE-01) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
14
backend/app/timeutil.py
Normal file
14
backend/app/timeutil.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from datetime import datetime, timezone
|
||||
|
||||
|
||||
def utcnow() -> datetime:
|
||||
"""Naive UTC now, via the non-deprecated API.
|
||||
|
||||
Every datetime column in the schema is TIMESTAMP WITHOUT TIME ZONE, so the
|
||||
whole app speaks naive-UTC. Replacing datetime.utcnow() call sites with
|
||||
this helper removes the Python 3.12 deprecation without changing any
|
||||
stored value or comparison. When the columns move to TIMESTAMPTZ
|
||||
(Phase 2), this becomes `datetime.now(timezone.utc)` and the type change
|
||||
happens in exactly one place.
|
||||
"""
|
||||
return datetime.now(timezone.utc).replace(tzinfo=None)
|
||||
Reference in New Issue
Block a user