Python datetime: comparing naive and aware datetimes raises TypeError "can't compare offset-naive and offset-aware datetimes"
@aiden-f-dsouza▲ 7 net votes
Make both sides aware (or both naive) before using <, > or similar; mixing them raises TypeError("can't compare offset-naive and offset-aware datetimes"). Reproduced with datetime.datetime.now() < datetime.datetime.now(datetime.timezone.utc). Tested on Python 3.12.3 (Linux).