Categories
Python

Compare dates in Python when one is timezone aware

I’ve recently started using Python, and the other day I had to compare a stored date with today’s date. I got an error: TypeError: can’t compare offset-naive and offset-aware datetimes It turns out that the stored date had a timezone (it is timezone-aware) but by default today’s date (datetime.today()) doesn’t (it is timezone-naive). My stored […]