From kde-commits Tue Jun 28 19:40:33 2005 From: David Jarvie Date: Tue, 28 Jun 2005 19:40:33 +0000 To: kde-commits Subject: KDE/kdepim/libkcal Message-Id: <1119987633.983215.19804.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=111998764502677 SVN commit 429762 by djarvie: Omit DTEND from VEVENT when the end date/time is the same as the start date/time. This is to comply with RFC2445, section 4.8.2.2. M +9 -4 icalformatimpl.cpp --- trunk/KDE/kdepim/libkcal/icalformatimpl.cpp #429761:429762 @@ -187,15 +187,20 @@ icalcomponent_add_property(vevent,icalproperty_new_dtstart(start)); if (event->hasEndDate()) { - // end time + // End time. + // RFC2445 says that if DTEND is present, it has to be greater than DTSTART. icaltimetype end; if (event->doesFloat()) { // kdDebug(5800) << " Event " << event->summary() << " floats." << endl; - // +1 day because end date is non-inclusive. - end = writeICalDate( event->dtEnd().date().addDays( 1 ) ); + if (event->dtEnd().date() != event->dtStart().date()) { + // +1 day because end date is non-inclusive. + end = writeICalDate( event->dtEnd().date().addDays( 1 ) ); + } } else { // kdDebug(5800) << " Event " << event->summary() << " has time." << endl; - end = writeICalDateTime(event->dtEnd()); + if (event->dtEnd() != event->dtStart()) { + end = writeICalDateTime(event->dtEnd()); + } } icalcomponent_add_property(vevent,icalproperty_new_dtend(end)); }