emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 74e9799: Handle missing start-time when importing i


From: Ulf Jasper
Subject: [Emacs-diffs] master 74e9799: Handle missing start-time when importing ical event (Bug#33277)
Date: Mon, 9 Sep 2019 12:36:26 -0400 (EDT)

branch: master
commit 74e9799bd89484b8d15bdd6597c68fc00d07e7f7
Author: Ulf Jasper <address@hidden>
Commit: Ulf Jasper <address@hidden>

    Handle missing start-time when importing ical event (Bug#33277)
    
    * lisp/calendar/icalendar.el (icalendar--convert-ical-to-diary): Set
    start time only if it is explicitly given in ical.  Do not use
    start-time as default for end-time (Bug#33277).
    
    * test/lisp/calendar/icalendar-tests.el (icalendar-import-bug-33277):
    New.  Test fix for Bug#33277.
---
 lisp/calendar/icalendar.el            |  7 ++++---
 test/lisp/calendar/icalendar-tests.el | 18 ++++++++++++++++++
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el
index 3c46982..3ae0fcb 100644
--- a/lisp/calendar/icalendar.el
+++ b/lisp/calendar/icalendar.el
@@ -2095,7 +2095,9 @@ written into the buffer `*icalendar-errors*'."
                                                              dtstart-zone))
                  (start-d (icalendar--datetime-to-diary-date
                            dtstart-dec))
-                 (start-t (icalendar--datetime-to-colontime dtstart-dec))
+                 (start-t (and dtstart
+                               (> (length dtstart) 8)
+                               (icalendar--datetime-to-colontime dtstart-dec)))
                  (dtend (icalendar--get-event-property e 'DTEND))
                  (dtend-zone (icalendar--find-time-zone
                              (icalendar--get-event-property-attributes
@@ -2148,8 +2150,7 @@ written into the buffer `*icalendar-errors*'."
                                     (icalendar--get-event-property-attributes
                                      e 'DTEND))
                                    "DATE")))
-                            (icalendar--datetime-to-colontime dtend-dec)
-                          start-t))
+                            (icalendar--datetime-to-colontime dtend-dec)))
             (icalendar--dmsg "start-d: %s, end-d: %s" start-d end-d)
             (cond
              ;; recurring event
diff --git a/test/lisp/calendar/icalendar-tests.el 
b/test/lisp/calendar/icalendar-tests.el
index baea480..0d7004d 100644
--- a/test/lisp/calendar/icalendar-tests.el
+++ b/test/lisp/calendar/icalendar-tests.el
@@ -1300,6 +1300,24 @@ UID:9188710a-08a7-4061-bae3-d4cf4972599a
 "
 ))
 
+(ert-deftest icalendar-import-bug-33277 ()
+  ;;bug#33277 -- start time equals end time
+  (icalendar-tests--test-import
+   "DTSTART:20181105T200000Z
+DTSTAMP:20181105T181652Z
+DESCRIPTION:
+LAST-MODIFIED:20181105T181646Z
+LOCATION:
+SEQUENCE:0
+SUMMARY:event with same start/end time
+TRANSP:OPAQUE
+"
+
+   "&2018/11/5 21:00 event with same start/end time\n"
+   "&5/11/2018 21:00 event with same start/end time\n"
+   "&11/5/2018 21:00 event with same start/end time\n"
+   ))
+
 (ert-deftest icalendar-import-multiple-vcalendars ()
   (icalendar-tests--test-import
    "DTSTART;VALUE=DATE:20110723



reply via email to

[Prev in Thread] Current Thread [Next in Thread]