From kde-commits Wed Aug 31 14:50:31 2005 From: Reinhold Kainhofer Date: Wed, 31 Aug 2005 14:50:31 +0000 To: kde-commits Subject: branches/KDE/3.5/kdepim/libkcal Message-Id: <1125499831.302041.6095.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=112550004803751 SVN commit 455447 by kainhofe: For all-day events the DTEND should be set to the last day of the event, not to the next day after the event (We misunderstood rfc 2445 in this regard). E.g. a DTEND: 20050831 *does* occur on August 31 (and end on that date). Originally, we also had it that way, but then misunderstood the rfc and for kde 3.1 we used the next day after the event as DTEND. Evolution and Mozilla do it similarly, but it's wrong, nonetheless. Actually, after pointing out the problem to them, the evolution guys will also use the correct way. See http://www.imc.org/ietf-calendar/archive1/msg03648.html (written by one of the authors of rfc 2445, so that's kind of authoritative) M +19 -1 compat.cpp M +1 -0 compat.h M +2 -2 icalformatimpl.cpp --- branches/KDE/3.5/kdepim/libkcal/compat.cpp #455446:455447 @@ -131,6 +131,21 @@ Compat::fixRecurrence( incidence ); } +/** We misunderstood rfc 2445 in this regard. For all-day events, the + DTEND is the last day of the event. E.g. a DTEND: 20050831 *does* + occure on August 31 (and end on that date). Originally, we also + had it that way, but then misunderstood the rfc and for kde 3.1 + we used the next day after the event as DTEND. Evolution and Mozilla + do it similarly, but it's wrong, nonetheless. + + See http://www.imc.org/ietf-calendar/archive1/msg03648.html + */ +void CompatPre35::fixFloatingEnd( QDate &endDate ) +{ + endDate = endDate.addDays( -1 ); +} + + int CompatPre34::fixPriority( int prio ) { if ( 0summary() << " floats." << endl; // if (event->dtEnd().date() != event->dtStart().date()) { // +1 day because end date is non-inclusive. - end = writeICalDate( event->dtEnd().date().addDays( 1 ) ); + end = writeICalDate( event->dtEnd().date() ); // } } else { // kdDebug(5800) << " Event " << event->summary() << " has time." << endl; @@ -958,7 +958,7 @@ icaltime = icalproperty_get_dtend(p); if (icaltime.is_date) { // End date is non-inclusive - QDate endDate = readICalDate( icaltime ).addDays( -1 ); + QDate endDate = readICalDate( icaltime ); if ( mCompat ) mCompat->fixFloatingEnd( endDate ); if ( endDate < event->dtStart().date() ) { endDate = event->dtStart().date();