Description
The schedule overlap check in is_host_available and other schedule-related functions use datetime.now() (timezone-unaware) while the schedule records use timezone-aware datetimes (created by parse_date which attaches UTC).
Comparing timezone-naive and timezone-aware datetimes can produce incorrect results or TypeError depending on the Python/sqlalchemy configuration.
Affected Code
src/quads/server/blueprints/schedules.py:447-454
src/quads/server/dao/schedule.py:263-267 (parse_date returns timezone-aware)
src/quads/server/blueprints/schedules.py:241-246 (datetime.now() is timezone-unaware)
Impact
- Schedule overlap checks may produce false negatives
- Possible TypeError on comparison
Recommended Fix
Use datetime.now(timezone.utc) or datetime.utcnow() consistently throughout, or use a utility function that always returns timezone-aware datetimes.
Description
The schedule overlap check in
is_host_availableand other schedule-related functions usedatetime.now()(timezone-unaware) while the schedule records use timezone-aware datetimes (created byparse_datewhich attaches UTC).Comparing timezone-naive and timezone-aware datetimes can produce incorrect results or
TypeErrordepending on the Python/sqlalchemy configuration.Affected Code
src/quads/server/blueprints/schedules.py:447-454src/quads/server/dao/schedule.py:263-267(parse_datereturns timezone-aware)src/quads/server/blueprints/schedules.py:241-246(datetime.now()is timezone-unaware)Impact
Recommended Fix
Use
datetime.now(timezone.utc)ordatetime.utcnow()consistently throughout, or use a utility function that always returns timezone-aware datetimes.