问题
I am using a very old version of Telerik RadScheduler that exports appointments to an ics file so they can be fed to an iPhone.
This is the telerik code:
TimeZoneInfo localZone = TimeZoneInfo.Local;
TimeSpan ts = localZone.BaseUtcOffset;
return RadScheduler.ExportToICalendar(scheduler.Appointments, ts);`
My server is in GMT, my iPhone is in NZDT (+13), my appointments are stored in UTC.
I have some all day appointments that are midnight til midnight NZDT time. They are exporting like this:
BEGIN:VEVENT DTSTART:20141205T110000Z
DTEND:20141206T110000Z
UID:20141202T140355Z-907
DTSTAMP:20141202T140355Z SUMMARY: Day Off
DESCRIPTION:Own Day END:VEVENT
When they display on the iPhone they don't show as all day events, they just blank out the whole day midnight to midnight as an appointment.
I am very willing to re-write the ical myself if it is wrong but I don't know what it should be. I have searched google for examples of iCal all day events but I can't find any proper documentation (maybe looking in the wrong place), and what I am finding appears to be inconsistent.
What I want to know is, is this something to do with the timezone or is the output incorrect? What should the start and end times be for all day events, or is there a key for "all day events" that needs to be added?
回答1:
not 100% sure about how iOS implements it but the RFC5545 3.6.1says:
[...]The "DTEND" property for a "VEVENT" calendar component specifies the non-inclusive end of the event. For cases where a "VEVENT" calendar component specifies a "DTSTART" property with a DATE value type but no "DTEND" nor "DURATION" property, the event's duration is taken to be one day.[...]
so in your case you should try to remove the DTEND
property.
来源:https://stackoverflow.com/questions/27251663/ical-feed-all-day-events-blank-out-entire-day