tags:

views:

155

answers:

2

Hi

I am using D-Day calendar and I am not sure but I got a weird problem.

I basically have this for my code

iCalendar iCal = iCalendar.LoadFromStream(file.InputStream);
 foreach (Event evt in iCal.Events)
                {
                   DateTime start = evt.DTStart.Date;
                   DateTime end = evt.DTEnd.Date;
                  // loop through it and get values.
                }

Yet when I import a calendar from google calendar the end date is messed up on some of the stuff I am importing.

Like for instance I have this

Title: should not show When: Sun, March 21(all day).

Yet when I import it in. I says the start date is the 21st yet the end date is the 22nd when it should be the 21st.

Not sure what is going on.

I am not really sure what other info I can give you guys.

I made a cmd line application and put the .ics file in it. If anyone knows a good place I can upload it and you guys can see what I mean.

This is what my cmd line is outputting.

Start Date Of this Record
Some one day task 3/25/2010 12:00:00 AM
End Date of this Record 3/26/2010 12:00:00 AM


Start Date Of this Record
Test using quick create(bubble that shows up when clicked on date box) - 1 day t
ask 3/21/2010 12:00:00 AM
End Date of this Record 3/22/2010 12:00:00 AM


Start Date Of this Record
Spans 2 days 3/30/2010 12:00:00 AM
End Date of this Record 4/1/2010 12:00:00 AM
+1  A: 

If it is an all day event, I believe the end time will be 00:00:00 on the next day, aka 12:00:00 AM. Is this not what you're seeing for the times?

The last example you give truly does span two days (March has 31 days), and is correct. The output you're seeing jives with the definition of an All Day Event. It begins at 12:00 AM and ends at 12:00 AM the next day.

If you wanted All Day events to truely stay only on the same day, you could do a check like:

if (((end - start) == TimeSpan.FromDays(1.0))
    && (start.Hour == 0 && start.Minute == 0))
{
    end = end - TimeSpan.FromSeconds(1.0); // now 23:59:59 same day as start
}
sixlettervariables
No it is just set as 12:00:00(see my edit for output).
chobo2
That is the same as 00:00:00 if you don't include AM/PM information.
sixlettervariables
Oh. So this what the ics standard wants or something I just find it so weird. For my calendar when someone put allDay I did like 12:00am to 11:30pm(they can only choose in half and hour increments).
chobo2
A: 

Chobo,

If you're trying to create all-day events in DDay.iCal it's really simple:

event.IsAllDay = true;

Is that what you're trying to accomplish? In all honesty your problem isn't all that clear from what you've already told us.

Thanks, -Doug

Doug
You seemed to understand it on the other forum lol.
chobo2