rfc2445,如何存储全天事件?

rfc2445, how to store all day events?

我正在创建一个日历应用程序,应该向 rfc-2445 specification. I've had a few issue with the All Day events here but now it has been resolved, you can see the SO question 投诉,但它迫使我提出以下问题。

当我选择 全天 活动时,例如从 20-10-2015 到 21-10-2015(活动持续时间为 2 天)实际上我从20-10-2015到22-10-2015需要在数据库中创建记录,否则将显示为一日活动。

And my question has two part:

  1. Is the above right and according to standard rfc-2445?
  2. Should I store such event in DB as from 20-10-2015 to 22-10-2015 and when show its details to end user I should decrease one day from end date or store it as 20-10-2015 to 21-10-2015 and increase by one day at end date when render it inside the calendar.

谢谢。

DTEND属性对应事件的非包容性结束,所以,你上面的例子是正确的

请参阅 https://www.rfc-editor.org/rfc/rfc5545#section-3.6.1,其中指定:

The "DTSTART" property for a "VEVENT" specifies the inclusive start of the event. For recurring events, it also specifies the very first instance in the recurrence set. The "DTEND" property for a "VEVENT" calendar component specifies the non-inclusive end of the event.

还有一个多天全天活动的示例:

The following is an example of the "VEVENT" calendar component used to represent a multi-day event scheduled from June 28th, 2007 to July 8th, 2007 inclusively. Note that the "DTEND" property is set to July 9th, 2007, since the "DTEND" property specifies the non-inclusive end of the event.

   BEGIN:VEVENT
   UID:20070423T123432Z-541111@example.com
   DTSTAMP:20070423T123432Z
   DTSTART;VALUE=DATE:20070628
   DTEND;VALUE=DATE:20070709
   SUMMARY:Festival International de Jazz de Montreal
   TRANSP:TRANSPARENT
   END:VEVENT

您会注意到我指的是 RFC5545,它已经废弃了 RFC2445。