mirror of
https://github.com/escalante29/WealthySmart.git
synced 2026-07-17 10:08:46 +02:00
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>
15 lines
594 B
Python
15 lines
594 B
Python
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)
|