Single day all day appointments in .ics files
Leaving this here for anyone else Googling.. I had trouble with the same, mix of all day events and half days particularly in Google Calendar.
My problem was related to how the ICS file was being force downloaded. sounds silly, but a header that forced download, prevented Google calendar from properly parsing all day events. Streaming to the browser had better results. Sample output here. (use VALUE=DATE) for single all day events.
BEGIN:VEVENT
UID:1248
DTSTART;VALUE=DATE:20151218
DTEND;VALUE=DATE:20151219
DTSTAMP:20151218T080000Z
CREATED:20151212T200409Z
DESCRIPTION:examplea
LAST-MODIFIED:20151218T080000Z
LOCATION:
SUMMARY:example summary
SEQUENCE:0
STATUS:CONFIRMED
TRANSP:OPAQUE
END:VEVENT
BEGIN:VEVENT
UID:1249
DTSTART;VALUE=DATE:20151217
DTEND;VALUE=DATE:20151218
DTSTAMP:20151217T080000Z
CREATED:20151212T200409Z
DESCRIPTION:example1
LAST-MODIFIED:20151217T080000Z
LOCATION:
SUMMARY:Example
SEQUENCE:0
STATUS:CONFIRMED
TRANSP:OPAQUE
END:VEVENT
@IceCool is right -- simply omitting the DTEND
is not enough...it will depend on the data type of DTSTART
whether that works.
The spec says that if DTSTART
has a DATE
data type, and there is no DTEND
then the event finishes at the end of the day that it starts. But if DTSTART
has a full DATE-TIME
data type, and there is no DTEND
then it finishes at the same time that it starts.
It's in section 3.6.1 of RFC 5545 (https://www.rfc-editor.org/rfc/rfc5545#page-54):
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. For cases where a "VEVENT" calendar component specifies a "DTSTART" property with a DATE-TIME value type but no "DTEND" property, the event ends on the same calendar date and time of day specified by the "DTSTART" property.
So, the upshot is, to get an all day event, this is not enough:
DTSTART:20100101T000000
It doesn't work because the data type is DATE-TIME
, and so the end of the event is the same as the start. To make an all day event you either need to add an explicit DTEND
(also of type DATE-TIME
):
DTSTART:20100101T000000
DTEND:20100102T000000
or use the DATE
data type, and then there's no need for a DTEND
:
DTSTART;VALUE=DATE:20100101
found the answer. to make an all day event you need to make the appointment end at midnight the day after.
The above comment RE: midnight the day after didn't work for me in Apple's iCal. To get around this, in each of the BEGIN:VEVENT sections, I have output the dates as follows:
DTSTART;VALUE=DATE:20100101
DTEND;VALUE=DATE:20100101
I don't know if you still need the Microsoft tags though?!