Jeff,
Thanks for the response. I found my problem and it wasn''t a bug in
your code, but a bug in mine. I had changed my variable names to make the code
more readable and never went and changed it in the function call that adds the
events to my calendar system. ERG!
So I did get it working and it actually works pretty slick. The
"arranged" events are the all day events...so I just had to use the
''Date.new'' and give it the (year, month, day) and it works. I
could do it with dtstart and dtend being the same day...or with dtend being the
same day +1.
cal.event do
if arranged
dtstart Date.new(startDate.year(), startDate.month(), startDate.day())
dtend Date.new(startDate.year(), startDate.month(), startDate.day())
else
dtstart
DateTime.parse("#{startDate.year()}-#{startDate.month()}-#{startDate.day()}T#{startTime}:00")
dtend
DateTime.parse("#{startDate.year()}-#{startDate.month()}-#{startDate.day()}T#{endTime}:00")
end
The resulting ICAL looks like...
DTSTART: 20080114T000000
DTEND: 20080114T000000
I''m working with the Zimbra Collaboration Suite and writing ruby code
to import our students class schedules into their calendars automatically...and
it seems to work fine when I use the correct variable names. :P
Thanks,
Matt
----- Original Message -----
From: "Jeff Rose" <jeff at rosejn.net>
To: "iCalendar developers & users" <icalendar-devel at
rubyforge.org>
Sent: Thursday, February 28, 2008 4:03:44 AM (GMT-0600) America/Guatemala
Subject: Re: [iCalendar-devel] All Day Events
Hi Matt,
This is an area of the specification which isn''t totally clear, and
I''ve seen that people run into problems. What program are you using to
view your calendars? If I create a basic event
c = Icalendar::Calendar.new
c.event do
dtstart Date.new(2008, 1, 1)
dtend Date.new(2008, 1, 2)
end
File.open("test.ics", "w") {|f| f.write(c.to_ical) }
When imported into my Thunderbird calendar it comes up as being an all
day event. Looking around on mailing lists it seems that some apps
might want all-day events to span midnight to midnight, so you could
give that a try with the app you are using. Let me know if it works,
and we can try to find a cross-calendar-app fix.
-Jeff
Matt Mencel wrote:> I must be stupid because this cannot be this hard.
>
> I''m trying to build an all day calendar event. In most clients it
shows up as an entry at the top of the day rather than blocking out the whole
day with an event.
>
> I have a bit of code that looks like this...
>
> cal.event do
> dtstart
DateTime.parse("#{startDate.year()}-#{startDate.month()}-#{startDate.day()}")
> dtend
DateTime.parse("#{startDate.year()}-#{startDate.month()}-#{startDate.day()+1}")
> end
>
> The ICAL entry from this looks like...
>
> DTSTART: 20080114T000000
> DTEND: 20080115T000000
>
>
> I also tried it in the format from the README
>
> cal.event do
> dtstart Date.nnew(2008, 01, 14)
> dtend Date.new(2008, 01, 15)
> end
>
> ...which produced...
> DTSTART: 20080114
> DTEND: 20080115
>
>
> When I create an all day event in my calendar system and export it to an
ICS file it looks like this...
>
> DTSTART;VALUE=DATE:20080114
> DTEND;VALUE=DATE:20080115
>
>
>
> I''m sure one of my above options should work, but maybe
there''s something special I need to do to make an "all day"
event?
>
> Thanks,
> Matt
> _______________________________________________
> 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