Fix TypeError: can't compare datetime.datetime to datetime.date