My interest in icalendar is more on the ical generation side instead of the ical parsing side. As such, I did a bit of work on a tzinfo mixin that will generate the timezone rules based on the tzinfo gem. This lets you do the following: estart = DateTime.new(2008, 12, 29, 8, 0, 0) eend = DateTime.new(2008, 12, 29, 11, 0, 0) tstring = "America/Chicago" tz = TZInfo::Timezone.get(tstring) cal = Calendar.new # generate timezone recurrence rules guaranteed to work for this # start date timezone = tz.ical_timezone(estart) cal.add(timezone) cal.event do dtstart estart dtend eend summary "Meeting with the man." description "Have a long lunch meeting and decide nothing..." klass "PRIVATE" end The recurrence rule generation is a little hacky, I didn''t reverse out all the recurrence relations from tzinfo, just the one of the current time period and the next one. Given that timezone info is localized per calendar, as long as you generate the timezone from your first event, you should be fine. Changes are here - http://github.com/sdague/icalendar/tree/master for all those interested. And there is a new 1.0.2.3 gem on github with these bits integrated. -Sean -- __________________________________________________________________ Sean Dague Mid-Hudson Valley sean at dague dot net Linux Users Group http://dague.net http://mhvlug.org There is no silver bullet. Plus, werewolves make better neighbors than zombies, and they tend to keep the vampire population down. __________________________________________________________________ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature URL: <http://rubyforge.org/pipermail/icalendar-devel/attachments/20081230/9c561c3f/attachment-0001.bin>
Mauricio Gomes
2009-Jan-05 16:12 UTC
[iCalendar-devel] integration of tzinfo with icalendar
On Tue, Dec 30, 2008 at 8:54 AM, Sean Dague <sean at dague.net> wrote:> My interest in icalendar is more on the ical generation side instead of > the ical parsing side. As such, I did a bit of work on a tzinfo mixin > that will generate the timezone rules based on the tzinfo gem. This > lets you do the following: > > estart = DateTime.new(2008, 12, 29, 8, 0, 0) > eend = DateTime.new(2008, 12, 29, 11, 0, 0) > tstring = "America/Chicago" > > tz = TZInfo::Timezone.get(tstring) > > cal = Calendar.new > # generate timezone recurrence rules guaranteed to work for this > # start date > timezone = tz.ical_timezone(estart) > > cal.add(timezone) > > cal.event do > dtstart estart > dtend eend > summary "Meeting with the man." > description "Have a long lunch meeting and decide nothing..." > klass "PRIVATE" > end > > The recurrence rule generation is a little hacky, I didn''t reverse out > all the recurrence relations from tzinfo, just the one of the current > time period and the next one. Given that timezone info is localized per > calendar, as long as you generate the timezone from your first event, > you should be fine. > > Changes are here - http://github.com/sdague/icalendar/tree/master for > all those interested. And there is a new 1.0.2.3 gem on github with > these bits integrated. > > -Sean > > -- > __________________________________________________________________ > > Sean Dague Mid-Hudson Valley > sean at dague dot net Linux Users Group > http://dague.net http://mhvlug.org > > There is no silver bullet. Plus, werewolves make better neighbors > than zombies, and they tend to keep the vampire population down. > __________________________________________________________________ > > > > _______________________________________________ > icalendar-devel mailing list > icalendar-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/icalendar-devel >I would also like to see these changes Sean has created as well as my bignum patch added to Icalendar gem 1.0.3. Is there anyone out there?
Mauricio Gomes wrote:> > I would also like to see these changes Sean has created as well as my > bignum patch added to Icalendar gem 1.0.3. Is there anyone out there? > _______________________________________________ > icalendar-devel mailing list > icalendar-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/icalendar-develMauricio, Can you send me a link to your bignum patch? I''ll add it into the github tree as well. -Sean -- __________________________________________________________________ Sean Dague Mid-Hudson Valley sean at dague dot net Linux Users Group http://dague.net http://mhvlug.org There is no silver bullet. Plus, werewolves make better neighbors than zombies, and they tend to keep the vampire population down. __________________________________________________________________ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature URL: <http://rubyforge.org/pipermail/icalendar-devel/attachments/20090105/1f362f40/attachment.bin>
Mauricio Gomes
2009-Jan-06 14:52 UTC
[iCalendar-devel] integration of tzinfo with icalendar
> Mauricio, > > Can you send me a link to your bignum patch? I''ll add it into the > github tree as well. > > -Sean >I''m attaching it. It''s against 1.0.2, but it''s really tiny and it can be copy and pasted if need be. Here is the original email I sent to the list explaining the patch: "I was having trouble parsing an ICS file and I kept getting this error: NotImplementedError: Value of type (Bignum) does not support to_ical method! from component.rb:223:in `sequence'' I looked through the ICS file and noticed the sequence numbers were really large, (ie, 12055194070). After looking through the RFC, section 4.3.8 defines the valid range for "integer" as -2147483648 to 2147483647. Numbers that large in Ruby get converted to Bignum, but the to_ical() method doesn''t support it." Thanks for doing this btw. Mauricio -------------- next part -------------- A non-text attachment was scrubbed... Name: bignum_fix.patch Type: application/octet-stream Size: 247 bytes Desc: not available URL: <http://rubyforge.org/pipermail/icalendar-devel/attachments/20090106/08e0479e/attachment.obj>
Reasonably Related Threads
- Icalendar::UnknownPropertyMethod: Unknown property type: on Parsing a ical file
- [RESEND] [PATCH] Call dominfo.device_delete instead of non-existant dominfo.device_destroy
- Patch and introduction
- Icalendar.Parse(StringIO.new(aString)) complains about missing method, bytesize
- [PATCH] Call dominfo.device_delete instead of non-existant dominfo.device_destroy