From edemaine at MIT.EDU Sat Jul 18 19:24:58 2009 From: edemaine at MIT.EDU (Erik Demaine) Date: Sat, 18 Jul 2009 13:24:58 -0400 (Eastern Daylight Time) Subject: [icalendar-dev] Timezone bug Message-ID: SUMMARY: The encoding mechanism of vDatetime handles tzinfo fields incorrectly (specifically with respect to daylight savings time). Attached is a simple patch that makes it work. DETAILS: Currently vDatetime.ical() tries to compute the utcoffset of the tzinfo, and then subtract that offset. This approach is valid, but the computation of the utcoffset is wrong, because it's done relative to datetime.now() instead of the actual datetime object (self.dt) to be converted. This is an issue for timezones whose utcoffset varies throughout the year, e.g., from daylight savings time. Replacing datetime.now() with self.dt would fix the code, but I opted to use the builtin 'asttimezone' method because it's slightly simpler. I really like your iCalendar package and find it extremely helpful. I hope that you will continue to develop it, e.g. by incorporating bugfixes suggested by the community. Let me know if I can help in any way. Erik -- Erik Demaine | edemaine at mit.edu | http://erikdemaine.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: patch Type: application/octet-stream Size: 544 bytes Desc: Url : http://codespeak.net/pipermail/icalendar-dev/attachments/20090718/4e237809/attachment.obj