Skip to content

[BUG][LOW] Timezone-unaware datetimes in schedule overlap checks #680

Description

@kambiz-aghaiepour

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions