From das at dase.in Thu Mar 8 16:57:30 2007 From: das at dase.in (das Dasein) Date: Thu, 8 Mar 2007 16:57:30 -0500 Subject: [iCalendar-devel] Recommended db structure for working with icalendar events. Message-ID: I am relatively new to Ruby and this mailing list. What are the recommended data structures for storing icalendar events in a database? If I want to be able to determine, for example, what events are valid for a specific date/time, will I need to do this by SQL query or do I need to create objects of icalendar events stored in the db and then determine those that are valid? Should a RRULE property, for example, be stored as one field of a record an or should the parameters be broken down and stored by FREQ, COUNT, UNTIL and etc? Tony -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/icalendar-devel/attachments/20070308/8efa6b78/attachment.html From larry.karnowski at gmail.com Fri Mar 9 10:29:19 2007 From: larry.karnowski at gmail.com (Larry Karnowski) Date: Fri, 9 Mar 2007 10:29:19 -0500 Subject: [iCalendar-devel] Recommended db structure for working with icalendar events. In-Reply-To: References: Message-ID: <2b27183e0703090729l58b0a55cwe5a8e7b6ce46de28@mail.gmail.com> Das, As for your RRULE property, currently iCalendar only handles the value as a single string, so you might as well just store the string. I'm currently hacking (slowly, very slowly) on an object model for RRULE. It'll take the string and expand it into an composite object, so storing the string is still going to work. HTH, Larry On 3/8/07, das Dasein wrote: > I am relatively new to Ruby and this mailing list. > > What are the recommended data structures for storing icalendar events in a > database? If I want to be able to determine, for example, what events are > valid for a specific date/time, will I need to do this by SQL query or do I > need to create objects of icalendar events stored in the db and then > determine those that are valid? > > Should a RRULE property, for example, be stored as one field of a record an > or should the parameters be broken down and stored by FREQ, COUNT, UNTIL and > etc? > > Tony > > _______________________________________________ > icalendar-devel mailing list > icalendar-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/icalendar-devel > From icalendar at kero.tmfweb.nl Sun Mar 11 12:28:31 2007 From: icalendar at kero.tmfweb.nl (icalendar at kero.tmfweb.nl) Date: Sun, 11 Mar 2007 17:28:31 +0100 Subject: [iCalendar-devel] RRULE in v0.98 Message-ID: <20070311162831.GA22649@bumblebee.m38c.nl> Hi all, I am trying to convert my own database to ical format, and since I already read my own stuff with Ruby, what would be easier than to use a Ruby tool to write ical format :) I have trouble with the recurrences, though. With code like: event.add_rrule "FREQ=WEEKLY" event.recurrence_rules << "INTERVAL=2" or event.add_rrule "FREQ=WEEKLY" event.add_rrule "INTERVAL=2" I get dumps like: RRULE:FREQ=WEEKLY\,INTERVAL=2 According to the RFC, I'd expect RRULE:FREQ=WEEKLY;INTERVAL=2 So either I don't understand how to use the icalendar API, or it is a bug. Also, I read you're working on making those rules into a class of their own. How's that coming along? I would be happy to write rrule.until = Date.today instead of rrule << "UNTIL=#{Date.today.to_ical}" PS: Evolution ignored RRULE:freq=WEEKLY, isn't ical case insensitive? +--- Kero ---------------------------------- kero at chello@nl ---+ | | +--- M38c ------------ http://members.chello.nl/k.vangelder ---+ From tlau at tlau.org Tue Mar 13 20:45:24 2007 From: tlau at tlau.org (Tessa Lau) Date: Tue, 13 Mar 2007 17:45:24 -0700 Subject: [iCalendar-devel] Serialized dates discard timezone info Message-ID: <45F745A4.5@tlau.org> Hi, First of all, kudos for writing an iCalendar parser/generator with a very intuitive API, unlike all the Python-based ones I've tried! I'm looking forward to using this. I'm trying to write a simple script to programmatically merge two calendars. I have this all working, but when I serialize the result back out, all the times are messed up. This is what the input DTSTART looks like for one of my events: DTSTART:20070314T180000Z and here's how to_ical serializes the same event: DTSTART:20070314T180000 When I load the resulting calendar file into Mozilla's Lightning calendar extension, the time of the event is incorrect, because Lightning interprets that as a local time when actually it's in GMT. I looked at the code in conversions.rb, and there is a "utc" parameter that can be passed to the Date.to_ical method, but it doesn't allow me to pass that parameter in when I'm serializing a calendar. So it seems like the short fix is to provide a way to pass the "utc" parameter all the way down through the components as they get recursively serialized. However it seems that there's a more fundamental flaw in the design. When a time string is parsed by the system, the system should determine what timezone it's in, and be able to output the same logical time in any timezone (whether that be GMT, which is what the "Z" means, or the user's local timezone, or anything else). The current code seems to just drop all timezone information and assume that the event is in the same timezone as the user. I'd also recommend using strftime instead of all the string manipulations you currently have in conversions.rb. I'm going to temporarily hack around the problem by always setting :utc => true, but I don't think that's going to work in all cases. Any other ideas? Thanks, --Tessa From tlau at tlau.org Wed Mar 14 17:53:09 2007 From: tlau at tlau.org (Tessa Lau) Date: Wed, 14 Mar 2007 14:53:09 -0700 Subject: [iCalendar-devel] Timezone serializing causes crash Message-ID: <45F86EC5.3010400@tlau.org> I received the below VTIMEZONE component in email as part of a calendar invite. Parsing it and then serializing it using icalendar causes the following crash using icalendar 0.98. Any ideas? --Tessa /var/lib/gems/1.8/gems/icalendar-0.98/lib/icalendar/component/timezone.rb:52: warning: multiple values for a block parameter (0 for 1) from /var/lib/gems/1.8/gems/icalendar-0.98/lib/icalendar/component.rb:121 /var/lib/gems/1.8/gems/icalendar-0.98/lib/icalendar/component/timezone.rb:52: warning: multiple values for a block parameter (0 for 1) from /var/lib/gems/1.8/gems/icalendar-0.98/lib/icalendar/component.rb:121 TypeError: can't convert Hash into String from /var/lib/gems/1.8/gems/icalendar-0.98/lib/icalendar/component.rb:121:in `+' from /var/lib/gems/1.8/gems/icalendar-0.98/lib/icalendar/component.rb:121:in `print_component' from /var/lib/gems/1.8/gems/icalendar-0.98/lib/icalendar/component/timezone.rb:52:in `to_ical' from /var/lib/gems/1.8/gems/icalendar-0.98/lib/icalendar/component/timezone.rb:54:in `to_ical' from /var/lib/gems/1.8/gems/icalendar-0.98/lib/icalendar/component/timezone.rb:53:in `to_ical' from /var/lib/gems/1.8/gems/icalendar-0.98/lib/icalendar/component.rb:121:in `print_component' from /var/lib/gems/1.8/gems/icalendar-0.98/lib/icalendar/component/timezone.rb:52:in `to_ical' from /var/lib/gems/1.8/gems/icalendar-0.98/lib/icalendar/component.rb:106:in `to_ical' from /var/lib/gems/1.8/gems/icalendar-0.98/lib/icalendar/component.rb:106:in `to_ical' from /var/lib/gems/1.8/gems/icalendar-0.98/lib/icalendar/component.rb:105:in `to_ical' from /var/lib/gems/1.8/gems/icalendar-0.98/lib/icalendar/component.rb:121:in `print_component' from /var/lib/gems/1.8/gems/icalendar-0.98/lib/icalendar/component.rb:103:in `to_ical' from (irb):9 == begin timezone-crash.ics == BEGIN:VCALENDAR BEGIN:VTIMEZONE TZID:/mozilla.org/20070129_1/America/Dawson X-LIC-LOCATION:America/Dawson BEGIN:DAYLIGHT TZOFFSETFROM:-0800 TZOFFSETTO:-0700 TZNAME:PDT DTSTART:19700308T020000 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3 END:DAYLIGHT BEGIN:STANDARD TZOFFSETFROM:-0700 TZOFFSETTO:-0800 TZNAME:PST DTSTART:19701101T020000 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11 END:STANDARD END:VTIMEZONE END:VCALENDAR == end timezone-crash.ics == From epugh at opensourceconnections.com Wed Mar 21 13:20:28 2007 From: epugh at opensourceconnections.com (Eric Pugh) Date: Wed, 21 Mar 2007 13:20:28 -0400 Subject: [iCalendar-devel] Parsing Datetime seems to be failing... Message-ID: <3E199CD5-A29B-469C-AE9C-BC8DD4A0DA5B@opensourceconnections.com> Hi all, What is the best way to debug the parsing of this chunk out of my Apple iCal file??? For some reason I am getting the start time as if the US/Eastern TZ wasn't taking place! I am using TZInfo to help deal with comparing UTC to timezone specific dates, but when I just ask my raw iCalendar Event for the start time, it shows up without the Timezone: Before parsing. ical: 2007-03-02T11:00:00Z BEGIN:VEVENT DTSTART;TZID=US/Eastern:20070302T110000 LOCATION:SAIC DTEND;TZID=US/Eastern:20070302T120000 SUMMARY:Re: CI Talk Redux UID:A6202042-1D3C-4212-A1CF-42D3D5715B17 SEQUENCE:7 DTSTAMP:20070222T142246Z DESCRIPTION:let's tentatively schedule a tech talk for 11-12 Friday 2 Ma r. Does that work?\n\nEric Pugh wrote:\nMatt\,\n\nKevin mentioned you'd like me to give the CI Talk again\, and today I was chatting with Mike G oddard and he expressed a similar desire. I can pretty much do it whene ver works best for you'all.\n\nI have been spending some time with Natha n working through some issues and giving him a hands on tour\, and I dem oed it to Nancy Snyder casually\, but getting the full \"why and how\" i s always good.\n\nEric\n\n---------------------------------------------- ---------\nPrincipal\nOpenSource Connections\nSite: http://www.opensourc econnections.com\nBlog: http://blog.opensourceconnections.com\nCell: 1-4 34-466-1467\n\n\n\n BEGIN:VALARM ACTION:AUDIO X-WR-ALARMUID:22811D8F-0C2F-447F-9ECC-13308C7DABAD ATTACH;VALUE=URI:Basso TRIGGER:-PT15M END:VALARM END:VEVENT Eric ------------------------------------------------------- Principal OpenSource Connections Site: http://www.opensourceconnections.com Blog: http://blog.opensourceconnections.com Cell: 1-434-466-1467 From r.oth at gmx.net Wed Mar 21 23:57:26 2007 From: r.oth at gmx.net (roland oth) Date: Thu, 22 Mar 2007 04:57:26 +0100 Subject: [iCalendar-devel] Parsing Datetime seems to be failing... In-Reply-To: <3E199CD5-A29B-469C-AE9C-BC8DD4A0DA5B@opensourceconnections.com> References: <3E199CD5-A29B-469C-AE9C-BC8DD4A0DA5B@opensourceconnections.com> Message-ID: <41636EC3-B6FC-4545-9D7B-DAFB4E1ECD62@gmx.net> > > Before parsing. ical: 2007-03-02T11:00:00Z Possibly the "Z" not a time Zone Indicator for Z = Zulu = GMT From epugh at opensourceconnections.com Thu Mar 22 09:13:11 2007 From: epugh at opensourceconnections.com (Eric Pugh) Date: Thu, 22 Mar 2007 09:13:11 -0400 Subject: [iCalendar-devel] Parsing Datetime seems to be failing... In-Reply-To: <41636EC3-B6FC-4545-9D7B-DAFB4E1ECD62@gmx.net> References: <3E199CD5-A29B-469C-AE9C-BC8DD4A0DA5B@opensourceconnections.com> <41636EC3-B6FC-4545-9D7B-DAFB4E1ECD62@gmx.net> Message-ID: <04A69BCF-1E5D-41FA-A07F-1B1DCC7D5E8D@opensourceconnections.com> Humm... Not sure.. I am trying to extract my code and make it more testable (shame on me for not having done it first!) and will let you'all know.. At least according to the iCal RFC, the Z means GMT. I didn't realize that the Z == Zulu == GMT, wondered why the letter Z was used, now I know! Eric On Mar 21, 2007, at 11:57 PM, roland oth wrote: >> >> Before parsing. ical: 2007-03-02T11:00:00Z > Possibly the "Z" not a time Zone Indicator for Z = Zulu = GMT > > _______________________________________________ > icalendar-devel mailing list > icalendar-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/icalendar-devel ------------------------------------------------------- Principal OpenSource Connections Site: http://www.opensourceconnections.com Blog: http://blog.opensourceconnections.com Cell: 1-434-466-1467 From r.oth at gmx.net Thu Mar 22 10:06:42 2007 From: r.oth at gmx.net (Roland Oth) Date: Thu, 22 Mar 2007 15:06:42 +0100 Subject: [iCalendar-devel] Parsing Datetime seems to be failing... In-Reply-To: <04A69BCF-1E5D-41FA-A07F-1B1DCC7D5E8D@opensourceconnections.com> References: <3E199CD5-A29B-469C-AE9C-BC8DD4A0DA5B@opensourceconnections.com> <41636EC3-B6FC-4545-9D7B-DAFB4E1ECD62@gmx.net> <04A69BCF-1E5D-41FA-A07F-1B1DCC7D5E8D@opensourceconnections.com> Message-ID: <20070322140642.279790@gmx.net> "zulu" = "Z" comes from the way the letters of the alphabet are used phonetically in aviation: It goes like sort of like this: alpha, bravo, charly, delta ..uniform,x-ray,zulu rgds Roland -- --------------------------------------------------------------- Roland Oth Bergengasse 6/7/15, 1220 Wien, Austria Mobile +43 (0)699 16993274 mailto:r.oth at gmx.net --------------------------------------------------------------- "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ... Jetzt GMX ProMail testen: www.gmx.net/de/go/mailfooter/promail-out From r.oth at gmx.net Thu Mar 22 10:06:42 2007 From: r.oth at gmx.net (Roland Oth) Date: Thu, 22 Mar 2007 15:06:42 +0100 Subject: [iCalendar-devel] Parsing Datetime seems to be failing... In-Reply-To: <04A69BCF-1E5D-41FA-A07F-1B1DCC7D5E8D@opensourceconnections.com> References: <3E199CD5-A29B-469C-AE9C-BC8DD4A0DA5B@opensourceconnections.com> <41636EC3-B6FC-4545-9D7B-DAFB4E1ECD62@gmx.net> <04A69BCF-1E5D-41FA-A07F-1B1DCC7D5E8D@opensourceconnections.com> Message-ID: <20070322140642.279790@gmx.net> "zulu" = "Z" comes from the way the letters of the alphabet are used phonetically in aviation: It goes like sort of like this: alpha, bravo, charly, delta ..uniform,x-ray,zulu rgds Roland -- --------------------------------------------------------------- Roland Oth Bergengasse 6/7/15, 1220 Wien, Austria Mobile +43 (0)699 16993274 mailto:r.oth at gmx.net --------------------------------------------------------------- "Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ... Jetzt GMX ProMail testen: www.gmx.net/de/go/mailfooter/promail-out From epugh at opensourceconnections.com Thu Mar 22 10:56:19 2007 From: epugh at opensourceconnections.com (Eric Pugh) Date: Thu, 22 Mar 2007 10:56:19 -0400 Subject: [iCalendar-devel] Parsing Datetime seems to be failing... In-Reply-To: <41636EC3-B6FC-4545-9D7B-DAFB4E1ECD62@gmx.net> References: <3E199CD5-A29B-469C-AE9C-BC8DD4A0DA5B@opensourceconnections.com> <41636EC3-B6FC-4545-9D7B-DAFB4E1ECD62@gmx.net> Message-ID: <1593DB3B-1ED7-4925-89F7-C8468C6B601C@opensourceconnections.com> Hi all, I've discovered part of the problem!!!! It turns out that Apple iCal outputs the DTSTART and DTEND elements with a ";" character instead of a ":" character. It actually does that for a couple other elements as well. Now, I am not sure if this is the cause of my problem, but it is at least a bug. Changed Elements: DTSTART;TZID=US-Mountain:20050120T170000 DTEND;20050120T184500 I haven't been able to discern is this an Apple or iCalendar bug though.... I've written a test against the 0.98 version that shows the problem. Without public SVN I can't do a diff, but I have attached the relevant files. Jeff, if there is a better place to submit this bug fix, please let me know. Eric Pugh -------------- next part -------------- A non-text attachment was scrubbed... Name: parser_test.rb Type: text/x-ruby-script Size: 2993 bytes Desc: not available Url : http://rubyforge.org/pipermail/icalendar-devel/attachments/20070322/b7c9ec3e/attachment.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: apple_ical_event.ics Type: text/calendar Size: 542 bytes Desc: not available Url : http://rubyforge.org/pipermail/icalendar-devel/attachments/20070322/b7c9ec3e/attachment-0001.bin -------------- next part -------------- On Mar 21, 2007, at 11:57 PM, roland oth wrote: >> >> Before parsing. ical: 2007-03-02T11:00:00Z > Possibly the "Z" not a time Zone Indicator for Z = Zulu = GMT > > _______________________________________________ > icalendar-devel mailing list > icalendar-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/icalendar-devel ------------------------------------------------------- Principal OpenSource Connections Site: http://www.opensourceconnections.com Blog: http://blog.opensourceconnections.com Cell: 1-434-466-1467 From john at myquire.com Thu Mar 22 14:00:06 2007 From: john at myquire.com (John Postlethwait) Date: Thu, 22 Mar 2007 11:00:06 -0700 Subject: [iCalendar-devel] Parsing Datetime seems to be failing... In-Reply-To: <1593DB3B-1ED7-4925-89F7-C8468C6B601C@opensourceconnections.com> References: <3E199CD5-A29B-469C-AE9C-BC8DD4A0DA5B@opensourceconnections.com> <41636EC3-B6FC-4545-9D7B-DAFB4E1ECD62@gmx.net> <1593DB3B-1ED7-4925-89F7-C8468C6B601C@opensourceconnections.com> Message-ID: Hi Eric, That is not actually an iCalendar bug but is the iCalendar formatting. Check out: http://www.ietf.org/rfc/rfc2445.txt and see section 4.1.1 for another example. (Examples using a semi-colon are actually all-over that document, that is just the first one I happened across.) -John Postlethwait On 3/22/07, Eric Pugh wrote: > > Hi all, > > I've discovered part of the problem!!!! It turns out that Apple > iCal outputs the DTSTART and DTEND elements with a ";" character > instead of a ":" character. It actually does that for a couple other > elements as well. Now, I am not sure if this is the cause of my > problem, but it is at least a bug. > > Changed Elements: > DTSTART;TZID=US-Mountain:20050120T170000 > DTEND;20050120T184500 > > I haven't been able to discern is this an Apple or iCalendar bug > though.... I've written a test against the 0.98 version that shows > the problem. Without public SVN I can't do a diff, but I have > attached the relevant files. > > Jeff, if there is a better place to submit this bug fix, please let > me know. > > > > Eric Pugh > > > > On Mar 21, 2007, at 11:57 PM, roland oth wrote: > > >> > >> Before parsing. ical: 2007-03-02T11:00:00Z > > Possibly the "Z" not a time Zone Indicator for Z = Zulu = GMT > > > > _______________________________________________ > > icalendar-devel mailing list > > icalendar-devel at rubyforge.org > > http://rubyforge.org/mailman/listinfo/icalendar-devel > > ------------------------------------------------------- > Principal > OpenSource Connections > Site: http://www.opensourceconnections.com > Blog: http://blog.opensourceconnections.com > Cell: 1-434-466-1467 > > > > > > _______________________________________________ > icalendar-devel mailing list > icalendar-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/icalendar-devel > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/icalendar-devel/attachments/20070322/e9721dc4/attachment.html From epugh at opensourceconnections.com Fri Mar 23 11:08:46 2007 From: epugh at opensourceconnections.com (Eric Pugh) Date: Fri, 23 Mar 2007 11:08:46 -0400 Subject: [iCalendar-devel] Parsing Datetime seems to be failing... In-Reply-To: References: <3E199CD5-A29B-469C-AE9C-BC8DD4A0DA5B@opensourceconnections.com> <41636EC3-B6FC-4545-9D7B-DAFB4E1ECD62@gmx.net> <1593DB3B-1ED7-4925-89F7-C8468C6B601C@opensourceconnections.com> Message-ID: <03647640-B882-477F-BC22-B00713AC2ABF@opensourceconnections.com> Can anyone else verify that the ruby icalendar doesn't properly handled the seperator being a ";"? I tossed in a line of code to substitute DTSTART; with DTSTART: and all of a sudden things started parsing! Seems to be in parser.rb some regex patterns that specify what passes and what fails. Eric On Mar 22, 2007, at 2:00 PM, John Postlethwait wrote: > Hi Eric, > > That is not actually an iCalendar bug but is the iCalendar > formatting. Check out: http://www.ietf.org/rfc/rfc2445.txt and see > section 4.1.1 for another example. (Examples using a semi-colon are > actually all-over that document, that is just the first one I > happened across.) > > -John Postlethwait > > On 3/22/07, Eric Pugh wrote: > Hi all, > > I've discovered part of the problem!!!! It turns out that Apple > iCal outputs the DTSTART and DTEND elements with a ";" character > instead of a ":" character. It actually does that for a couple other > elements as well. Now, I am not sure if this is the cause of my > problem, but it is at least a bug. > > Changed Elements: > DTSTART;TZID=US-Mountain:20050120T170000 > DTEND;20050120T184500 > > I haven't been able to discern is this an Apple or iCalendar bug > though.... I've written a test against the 0.98 version that shows > the problem. Without public SVN I can't do a diff, but I have > attached the relevant files. > > Jeff, if there is a better place to submit this bug fix, please let > me know. > > > > Eric Pugh > > > > On Mar 21, 2007, at 11:57 PM, roland oth wrote: > > >> > >> Before parsing. ical: 2007-03-02T11:00:00Z > > Possibly the "Z" not a time Zone Indicator for Z = Zulu = GMT > > > > _______________________________________________ > > icalendar-devel mailing list > > icalendar-devel at rubyforge.org > > http://rubyforge.org/mailman/listinfo/icalendar-devel > > ------------------------------------------------------- > Principal > OpenSource Connections > Site: http://www.opensourceconnections.com > Blog: http://blog.opensourceconnections.com > Cell: 1-434-466-1467 > > > > > > _______________________________________________ > icalendar-devel mailing list > icalendar-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/icalendar-devel > > > _______________________________________________ > icalendar-devel mailing list > icalendar-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/icalendar-devel ------------------------------------------------------- Principal OpenSource Connections Site: http://www.opensourceconnections.com Blog: http://blog.opensourceconnections.com Cell: 1-434-466-1467 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/icalendar-devel/attachments/20070323/adab1304/attachment.html From epugh at opensourceconnections.com Wed Mar 28 16:18:45 2007 From: epugh at opensourceconnections.com (Eric Pugh) Date: Wed, 28 Mar 2007 16:18:45 -0400 Subject: [iCalendar-devel] Changing Parser to support Timezones Message-ID: Hi all, I've monkey patched parser.rb to handle timezones, so everything comes out as GMT. I'm using the TZinfo library to handle this, and have some icky hacks to deal with Timezones that are specified oddly in Apple's iCal... Does anyone have a better approach to this? Eric # Dates, Date-Times & Times # NOTE: invalid dates & times will be returned as strings... def parse_datetime(name, params, value) #puts "" #puts name #puts params #puts value timezone ="" begin dt = DateTime.parse(value) # if we have timezone information, use it to convert to UTC if !value.index("TZID=").nil? startIndex = value.index("TZID=") endIndex = value.index(":") timezone = value[startIndex+5..endIndex-1] if timezone =="(GMT-05.00) Eastern Time (US & Canada)" timezone = "US/Eastern" end timezone.gsub!("-","/") if timezone == "Pacific" timezone="US/Pacific" end #puts "Timezone: #{timezone}" tz = TZInfo::Timezone.get(timezone) #puts "Before fixing UTC: #{dt}" dt = tz.local_to_utc(DateTime.new (dt.year,dt.month,dt.day,dt.hour,dt.min,dt.sec)) #puts "After fixing UTC: #{dt} (Local is: #{tz.utc_to_local (dt)})" end dt rescue Exception => ex puts "Exception parsing datetime: #{ex.to_s} Value: # {value} Timezone: #{timezone}" value end end # Dates, Date-Times & Times # NOTE: invalid dates & times will be returned as strings... def parse_datetime(name, params, value) #puts "" #puts name #puts params #puts value timezone ="" begin dt = DateTime.parse(value) # if we have timezone information, use it to convert to UTC if !value.index("TZID=").nil? startIndex = value.index("TZID=") endIndex = value.index(":") timezone = value[startIndex+5..endIndex-1] if timezone =="(GMT-05.00) Eastern Time (US & Canada)" timezone = "US/Eastern" end timezone.gsub!("-","/") if timezone == "Pacific" timezone="US/Pacific" end #puts "Timezone: #{timezone}" tz = TZInfo::Timezone.get(timezone) #puts "Before fixing UTC: #{dt}" dt = tz.local_to_utc(DateTime.new (dt.year,dt.month,dt.day,dt.hour,dt.min,dt.sec)) #puts "After fixing UTC: #{dt} (Local is: #{tz.utc_to_local (dt)})" end dt rescue Exception => ex puts "Exception parsing datetime: #{ex.to_s} Value: # {value} Timezone: #{timezone}" value end end ------------------------------------------------------- Principal OpenSource Connections Site: http://www.opensourceconnections.com Blog: http://blog.opensourceconnections.com Cell: 1-434-466-1467 From epugh at opensourceconnections.com Fri Mar 30 10:57:19 2007 From: epugh at opensourceconnections.com (Eric Pugh) Date: Fri, 30 Mar 2007 10:57:19 -0400 Subject: [iCalendar-devel] Handling start and duration but no end for Events Message-ID: <12FD59BA-3EE2-4783-BE31-EFC0E2929349@opensourceconnections.com> Hi all, I've got an event that looks like: BEGIN:VEVENT DTSTART;TZID=US/Eastern:20070402T140000 SUMMARY:Call Robert UID:A11B2175-8082-4839-B253-74D1A6CACBA9 SEQUENCE:4 DTSTAMP:20070329T150439Z DESCRIPTION:Call to find out about bringing in Window guys...... \n\n4 34-962-7950 DURATION:PT1H BEGIN:VALARM ACTION:AUDIO TRIGGER:-PT15M X-WR-ALARMUID:76466515-A5C5-41C1-AECF-BF8C8BF972E0 X-ICF-AUTOALARM:TRUE ATTACH;VALUE=URI:Basso END:VALARM END:VEVENT It has a start time, but no end time. However, it does have a duration of PT1H. My app is failing cause I have no end time. Should the iCalendar parser handle the fact that the end time isn't definined, and supply it based on the start time + duration? Or is this the responsibility of the user of the parser??? I'm asking more from an understanding point of view? Seeing if I should patch icalendar parser or deal with it in my code. Eric ------------------------------------------------------- Principal OpenSource Connections Site: http://www.opensourceconnections.com Blog: http://blog.opensourceconnections.com Cell: 1-434-466-1467