Why this matters
Avoids subtle bugs with DST/offset math and makes comparisons reliable.
Store and compare datetimes as timezone-aware (UTC). Convert to local time only at the edges (UI/IO).
Avoids subtle bugs with DST/offset math and makes comparisons reliable.
Side-by-side examples engineers can pattern-match during review.
from datetime import datetime
expires_at = datetime.now() # naivefrom datetime import datetime, timezone
expires_at = datetime.now(timezone.utc)datetime.utcnow()datetime.now(timezone.utc)From the same buckets as this rule.