DATE003warningPro
db-datetime-awareness
Database datetime used in operations without timezone check
Applies to: Python
Why this matters
Database queries often return naive datetimes (no timezone info). When you subtract timedelta or compare with max()/min() against timezone-aware datetimes, Python raises 'can't compare offset-naive and offset-aware datetimes'. Always check .tzinfo before datetime arithmetic, or ensure your DB returns aware datetimes.
Catch it before it ships
pip install stablestack # or: npx stablestackstablestack # scans your project, DATE003 includedstablestack explain DATE003DATE003 is part of the Pro rule set. See pricing — the free tier ships 24 checks with no signup.
False positive in your codebase? Suppress a single line with # noqa: DATE003