aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Jasper2019-09-09 18:35:02 +0200
committerUlf Jasper2019-09-09 18:35:02 +0200
commit74e9799bd89484b8d15bdd6597c68fc00d07e7f7 (patch)
tree74756323a885eb3ce329c68ccb6852682db7a9e7
parent4042dad139d922723aabcfaef5662db8204fb355 (diff)
downloademacs-74e9799bd89484b8d15bdd6597c68fc00d07e7f7.tar.gz
emacs-74e9799bd89484b8d15bdd6597c68fc00d07e7f7.zip
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.
-rw-r--r--lisp/calendar/icalendar.el7
-rw-r--r--test/lisp/calendar/icalendar-tests.el18
2 files changed, 22 insertions, 3 deletions
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el
index 3c46982c7b0..3ae0fcbe977 100644
--- a/lisp/calendar/icalendar.el
+++ b/lisp/calendar/icalendar.el
@@ -2095,7 +2095,9 @@ written into the buffer `*icalendar-errors*'."
2095 dtstart-zone)) 2095 dtstart-zone))
2096 (start-d (icalendar--datetime-to-diary-date 2096 (start-d (icalendar--datetime-to-diary-date
2097 dtstart-dec)) 2097 dtstart-dec))
2098 (start-t (icalendar--datetime-to-colontime dtstart-dec)) 2098 (start-t (and dtstart
2099 (> (length dtstart) 8)
2100 (icalendar--datetime-to-colontime dtstart-dec)))
2099 (dtend (icalendar--get-event-property e 'DTEND)) 2101 (dtend (icalendar--get-event-property e 'DTEND))
2100 (dtend-zone (icalendar--find-time-zone 2102 (dtend-zone (icalendar--find-time-zone
2101 (icalendar--get-event-property-attributes 2103 (icalendar--get-event-property-attributes
@@ -2148,8 +2150,7 @@ written into the buffer `*icalendar-errors*'."
2148 (icalendar--get-event-property-attributes 2150 (icalendar--get-event-property-attributes
2149 e 'DTEND)) 2151 e 'DTEND))
2150 "DATE"))) 2152 "DATE")))
2151 (icalendar--datetime-to-colontime dtend-dec) 2153 (icalendar--datetime-to-colontime dtend-dec)))
2152 start-t))
2153 (icalendar--dmsg "start-d: %s, end-d: %s" start-d end-d) 2154 (icalendar--dmsg "start-d: %s, end-d: %s" start-d end-d)
2154 (cond 2155 (cond
2155 ;; recurring event 2156 ;; recurring event
diff --git a/test/lisp/calendar/icalendar-tests.el b/test/lisp/calendar/icalendar-tests.el
index baea4804045..0d7004d7106 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
1300" 1300"
1301)) 1301))
1302 1302
1303(ert-deftest icalendar-import-bug-33277 ()
1304 ;;bug#33277 -- start time equals end time
1305 (icalendar-tests--test-import
1306 "DTSTART:20181105T200000Z
1307DTSTAMP:20181105T181652Z
1308DESCRIPTION:
1309LAST-MODIFIED:20181105T181646Z
1310LOCATION:
1311SEQUENCE:0
1312SUMMARY:event with same start/end time
1313TRANSP:OPAQUE
1314"
1315
1316 "&2018/11/5 21:00 event with same start/end time\n"
1317 "&5/11/2018 21:00 event with same start/end time\n"
1318 "&11/5/2018 21:00 event with same start/end time\n"
1319 ))
1320
1303(ert-deftest icalendar-import-multiple-vcalendars () 1321(ert-deftest icalendar-import-multiple-vcalendars ()
1304 (icalendar-tests--test-import 1322 (icalendar-tests--test-import
1305 "DTSTART;VALUE=DATE:20110723 1323 "DTSTART;VALUE=DATE:20110723