[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepim/libkcal
From:       David Jarvie <software () astrojar ! org ! uk>
Date:       2005-06-28 19:40:33
Message-ID: 1119987633.983215.19804.nullmailer () svn ! kde ! org
[Download RAW message or body]

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));
   }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic