Just wondering if there might be someone who got timezone support of some kind working for vCalendars in VPIM? I have an vCalendar input file started off with something like this: BEGIN:VCALENDAR METHOD:REQUEST PRODID:Microsoft CDO for Microsoft Exchange VERSION:2.0 BEGIN:VTIMEZONE TZID:(GMT-05.00) Eastern Time (US & Canada) X-MICROSOFT-CDO-TZID:10 BEGIN:STANDARD DTSTART:16010101T020000 TZOFFSETFROM:-0400 TZOFFSETTO:-0500 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=11;BYDAY=1SU END:STANDARD BEGIN:DAYLIGHT DTSTART:16010101T020000 TZOFFSETFROM:-0500 TZOFFSETTO:-0400 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=2SU END:DAYLIGHT END:VTIMEZONE BEGIN:VEVENT DTSTAMP:20080107T155404Z DTSTART;TZID="(GMT-05.00) Eastern Time (US & Canada)":20080107T123000 The event.dstart from the Vpim parsed vCalendar will have its Timezone be set to localtime. It ignores the TZID of the DSTART. Any hints on how to make this work so that ether the event.dstart has the right timezone or can be set to the valid UTC? As far as I can tell, both Vpim and the ruby iCalendar libraries have similar problems handling this. Thanks Rob ?????????????????????????????? Robert J. Berger - Internet Bandwidth Development, LLC. Voice: 408-838-8896 eFax: +1-408-490-2868 http://www.ibd.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/vpim-talk/attachments/20080108/4ccb6c2d/attachment-0001.html
Quoting rberger at ibd.com, on Tue, Jan 08, 2008 at 02:11:58AM -0800:> Just wondering if there might be someone who got timezone support of > some kind working for vCalendars in VPIM?No. When I started vPim there weren''t even any libraries in ruby to deal with timezones. They exist now, but I''ve no need for TZ support, so unless someone steps up to the plate to do the work, it probably won''t happen.> As far as I can tell, both Vpim and the ruby iCalendar libraries have > similar problems handling this.Not surprising, iCalendar is a fork of vPim. Sam
Well, I got enough timezone stuff working for my application. I just needed to be able to parse iCalendar files that had a single event and a single timezone (at least so far :-) With the power of Ruby, I was able to create a ruby file that "monkey patches" the vpim library without touching any of the vpim library files and add the functionality I needed. (the file is attached) But I''m sure I didn''t do it the best way and there are probably some horrible hacks inside. If people come up with better ways or suggestions for improvement, let me know. The main functionality implemented is the ability to take DTSTART and DTEND times that are in some local time and convert it to UTC. It adds Vtimezone to be a component like, Vevent, Vtodo and Vjournal. It makes StandardTimeRules and DaylightSavingsTimeRules as components of Vtimezone. You can use the to_utz(date-time) method of Vtimezone to get the utc time of a dtstart or dtend (theoretically any object with proptime property). # Example Usage: require ''vpim'' require ''<path to the monkey patch file>/vtimezone'' icsfile = File.open("some_ical_file.ics").readlines cal = Vpim::Icalendar.decode(icsfile).first timezone = cal.components(Vpim::Icalendar::Vtimezone).first dtstart = cal.components(Vpim::Icalendar::Vevent).first.dtstart dtstart_utc = timezone.to_utc(dtstart) It assumes that a calendar only has one event and one timezone. It doesn''t actually use the TZID property of a the date-time object. It just assumes the one timezone matches the timezone of all non-utc date- times. It probably wouldn''t be toooo hard to actually support multiple events, and timezones, but I don''t need it and don''t have the time right now. The Vpim library was quite pleasant to hack. My thanks to Sam Roberts for making it available and doing such a nice job. Also thanks to David Frankel of Telethought / ZipDX (http://www.zipdx.com) whose project this was done for. Its great to be working on a project with Ruby! I would encourage anyone who is up to it, to take this and the library and make this work all the way! -------------- next part -------------- A non-text attachment was scrubbed... Name: vtimezone.rb Type: text/x-ruby-script Size: 10062 bytes Desc: not available Url : http://rubyforge.org/pipermail/vpim-talk/attachments/20080118/6c855a03/attachment.bin -------------- next part -------------- ?????????????????????????????? Robert J. Berger - Internet Bandwidth Development, LLC. Voice: 408-838-8896 eFax: +1-408-490-2868 http://www.ibd.com
Quoting rberger at ibd.com, on Fri, Jan 18, 2008 at 07:19:39PM -0800:> With the power of Ruby, I was able to create a ruby file that "monkey > patches" the vpim library without touching any of the vpim library > files and add the functionality I needed. (the file is attached)> But I''m sure I didn''t do it the best way and there are probably some > horrible hacks inside. If people come up with better ways or > suggestions for improvement, let me know.Can you refactor this as a patch so it can be cleanly integrated? Preferably with some unit tests :-) If commit access would help, tell me your rubyforge username. Cheers, Sam