From tlau at tlau.org Thu Feb 23 00:29:48 2006 From: tlau at tlau.org (Tessa Lau) Date: Wed, 22 Feb 2006 15:29:48 -0800 Subject: [icalendar-dev] Handling timezones in dtstart/dtend Message-ID: <20060222232947.GA29671@ofb.net> Hi, I'm really happy to see that someone's writing an iCalendar library for Python! I've done my share of writing simple ical parsers and generators, so I appreciate the effort that's gone into this. I'm running into a problem with parsing iCalendar data files generated by Lotus Notes (example attached). These calenders specify the datestart and dateend using a custom timezone that's defined earlier in the .ics file. However, the parser doesn't seem to handle these timezones correctly, and gives me a naive datetime object rather than a timezone-aware datetime. What I think should happen is that the parser should recognize that the timezone is specified as a parameter on the dtstart property, and retrieve that timezone from where it was specified earlier in the calendar data. Alternatively, I can look for the presence of this TZID property, and parse out the timezone info myself, and convert the naive datetime to an aware datetime. However, it seems like this should be handled by the iCalendar library. What do you think? Thanks, --Tessa -------------- next part -------------- A non-text attachment was scrubbed... Name: test2.ics Type: text/calendar Size: 1297 bytes Desc: not available Url : http://codespeak.net/pipermail/icalendar-dev/attachments/20060222/10486b70/attachment.ics From sidnei at enfoldsystems.com Thu Feb 23 01:08:13 2006 From: sidnei at enfoldsystems.com (Sidnei da Silva) Date: Wed, 22 Feb 2006 21:08:13 -0300 Subject: [icalendar-dev] Handling timezones in dtstart/dtend In-Reply-To: <20060222232947.GA29671@ofb.net> References: <20060222232947.GA29671@ofb.net> Message-ID: <20060223000813.GD4398@cotia> On Wed, Feb 22, 2006 at 03:29:48PM -0800, Tessa Lau wrote: | | Hi, | | I'm really happy to see that someone's writing an iCalendar library | for Python! I've done my share of writing simple ical parsers and | generators, so I appreciate the effort that's gone into this. | | I'm running into a problem with parsing iCalendar data files generated | by Lotus Notes (example attached). These calenders specify the | datestart and dateend using a custom timezone that's defined earlier | in the .ics file. However, the parser doesn't seem to handle these | timezones correctly, and gives me a naive datetime object rather than | a timezone-aware datetime. | | What I think should happen is that the parser should recognize that | the timezone is specified as a parameter on the dtstart property, and | retrieve that timezone from where it was specified earlier in the | calendar data. | | Alternatively, I can look for the presence of this TZID property, and | parse out the timezone info myself, and convert the naive datetime to | an aware datetime. However, it seems like this should be handled by | the iCalendar library. | | What do you think? For the records, the 'DateUtil' python package can create a timezone object from a ical file. That's what I'm using. http://labix.org/python-dateutil -- Sidnei da Silva Enfold Systems, LLC. http://enfoldsystems.com