I changed the code, and added an AllDay property on the when object, that will be set to true, if you read the feed, and if you create/change a When object, it results in not saving the time portion. I also added the Utilities helper to just convert a datetime object to UTCDate.

This will be in the next push.

Tx

Frank Mantek

On 5/10/06, Reto <[EMAIL PROTECTED] > wrote:

I've also encountered this problem. Ronnotel has half the solution, you
need to check to see if it's an all day event, and if it is, then
output the XML to contain no time information.

The following snipit replaces part of the WriteLocalDateTimeInUtc
method within the AtomBase class, after the trace code has run. Note
that to schedule an all day event, the end date must be one day later
than the start date, and I've made the assumption that a time of
midnight exactly should be considered an 'all day' event.

if (elementName.Length > 0)
{
    TimeSpan diff = TimeZone.CurrentTimeZone.GetUtcOffset(dateTime);
    int hours = diff.Hours;

                bool allDay = isAttribute && dateTime.TimeOfDay.TotalSeconds == 0;

                string format = allDay? "yyyy-MM-dd" : "yyyy-MM-ddTHH:mm:ss";
    string strOutput = dateTime.ToString(format,
CultureInfo.InvariantCulture);

                if (!allDay)
                {
                        string timezone;

                        if (diff > TimeSpan.Zero)
                        {
                                timezone = String.Format(CultureInfo.InvariantCulture ,
"+{0:00}:00", hours);
                        }
                        else if (diff < TimeSpan.Zero)
                        {
                                timezone = String.Format(CultureInfo.InvariantCulture ,
"-{0:00}:00", hours);
                        }
                        else
                        {
                                timezone = "Z";
                        }
                        strOutput += timezone;
                }


    if (!isAttribute)
    {
        WriteElementStart(writer, elementName);
        writer.WriteString(strOutput);
        writer.WriteEndElement();
    }
    else
    {
        writer.WriteAttributeString(elementName, strOutput);
    }
}

A better solution would be to add an 'All Day' flag to the When class
or EventEntry class and check for that.

Cheers
Reto



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Google Calendar Data API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/google-calendar-help-dataapi
-~----------~----~----~----~------~----~------~--~---

Reply via email to