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.
This commit is contained in:
Ulf Jasper 2019-09-09 18:35:02 +02:00
parent 4042dad139
commit 74e9799bd8
2 changed files with 22 additions and 3 deletions

View file

@ -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

View file

@ -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