From rick.denatale at gmail.com Sun Sep 21 17:52:57 2008 From: rick.denatale at gmail.com (Rick DeNatale) Date: Sun, 21 Sep 2008 17:52:57 -0400 Subject: [iCalendar-devel] Patch to capture tzid of events on icalendar parsing Message-ID: I have need to import icalendar format data from apps like google calendar and ical.app, both of which produce datetime values with specified timezones. Neither the icalendar gem nor it's competitor vpim support this. I forked icalendar this afternoon to add "the simplest code that could work". I've punted so far on actually using the timezone components in the imported file since both google calendar and ical.app seem to use timezone ids which are recognized by the TZInfo gem. My fork is at git://github.com/rubyredrick/icalendar.git Here's my commit comment with some more details. Added timezone awareness to datetime attributes DateTime now has icalendar_tzid and icalendar_tzid= methods This is to provide support for conformance with RFC 2445 Section 4.3.5, when PARSING icalendar input Parsing a component property which is a datetime will set this to: UTC if the value for the datetime ends with Z, e.g. DTSTART:19970903T163000Z corresponding to FORM #2, DATE WITH UTC TIME in the RFC The specified TZID parameter value if specified in the attribute line, e.g. DTSTART;TZID=America/Chicago:19970903T163000 corresponding to FORM #3 DATE WITH LOCAL TIME AND TIMEZONE REFERENCE nil otherwise, e.g. DTSTART:19970903T163000 corresponding to FORM #1 DATE WITH LOCAL TIME The datetime is NOT adjusted for timezone when the property is parsed. The adjustment SHOULD be done using the timezone components in the containing calendar, however it may be possible to use the TZInfo gem to do the conversion when processing input from google calendar, and ical.app on the Macintosh since both seem to use tzids which are in the Olsen Timezone database used by TZInfo and MS Outlook seems to output datetimes in FORM #2. Since I currently have no need to export icalendar format with anything other than FORM 2 datetimes, there is minimal support for export. The only thing I have done is to output either a FORM 2, or FORM 1 value string for a datetime depending on whether or not icalendar_tzid is set to "UTC" -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From alet.roux at gmail.com Tue Sep 30 11:44:22 2008 From: alet.roux at gmail.com (Alet Roux) Date: Tue, 30 Sep 2008 16:44:22 +0100 Subject: [iCalendar-devel] How to get icalendar to ignore nonconforming properties? Message-ID: <11d34de50809300844j7e3f2115qf6f26420f5fd96af@mail.gmail.com> Hi, I'm using icalendar to parse an ICal file that was generated by KOrganizer. The problem comes when parsing ICal entries like BEGIN:VJOURNAL DTSTAMP:20080929T171106Z CREATED:20060802T092541Z UID:libkcal-540603334.724 SEQUENCE:2 LAST-MODIFIED:20060802T133609Z DESCRIPTION:What I did that day SUMMARY:What I did that day PRIORITY:5 DTSTART;VALUE=DATE:20060802 END:VJOURNAL Here KOrganizer has added the PRIORITY property to this entry, and since this is not in RFC-2445, this entry cannot be parsed, and my code crashes with the exception "Method Name: priority". Is it possible to make it such that nonconforming entries are simply ignored, so that the rest of the file can be parsed? In this case, for example, I would be more than happy if the priority is never assigned because it obviously makes no sense for a journal entry to have a priority. I am fairly new to Ruby, so I apologise if this is a silly question. I have had a good look at the documentation, but have not found anything that would help with this. Best wishes Alet -------------- next part -------------- An HTML attachment was scrubbed... URL: