Single day all day appointments in .ics files

后端 未结 8 2043
一向
一向 2021-01-01 09:44

I\'m creating an ics file using ASP.NET for importing holiday into Outlook 2007 and trying to set the all-day-event flag. This works fine on multi-day holidays, but for sing

8条回答
  •  我在风中等你
    2021-01-01 10:12

    @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 (http://tools.ietf.org/html/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
    

提交回复
热议问题