dakrauth / django-swingtime

📆 Event and occurrence scheduling application for Django
https://dakrauth.github.io/django-swingtime/
MIT License
318 stars 99 forks source link

Fix mixing of offset-aware and -naive datetimes #16

Closed Fortschritt closed 8 years ago

Fortschritt commented 8 years ago

datetime.time() is offset-naive but has been used in datetime.combine() operations with potentially offset-aware operands, resulting in TypeErrors. Now time() gets the tzinfo of the other operand, which should be backwards-compatible (as offset-naive times also have the tzinfo paramter, it's just set to None) while ensuring coherent timezone settings if tzinfo is set.