Commit 7261b4d9 authored by Ulf Jasper's avatar Ulf Jasper
Browse files

icalendar: fix issues regarding timezones without dst

* lisp/calendar/icalendar.el (icalendar--convert-tz-offset): Return
complete cons when offsets of standard time and daylight saving
time are equal.
(icalendar-export-region): Fix unbound variable warning.

* test/automated/icalendar-tests.el (icalendar--parse-vtimezone): Add
testcase where offsets of standard time and daylight saving time
are equal.
(icalendar-real-world): Fix error in test case.  Expected result
was wrong when offsets of standard time and daylight saving time
were equal.
parent a97fd0eb
2014-11-16 Ulf Jasper <ulf.jasper@web.de>
* calendar/icalendar.el (icalendar--convert-tz-offset): Return
complete cons when offsets of standard time and daylight saving
time are equal.
(icalendar-export-region): Fix unbound variable warning.
2014-11-16 Fabián Ezequiel Gallina <fgallina@gnu.org>
* progmodes/python.el (run-python): Allow CMD to be optional and
......
......@@ -509,15 +509,19 @@ The strings are suitable for assembling into a TZ variable."
":"
(substring offsetto 3 5))
;; The start time.
(unless no-dst
(let* ((day (icalendar--get-weekday-number (substring byday -2)))
(week (if (eq day -1)
(let* ((day (if no-dst
1
(icalendar--get-weekday-number (substring byday -2))))
(week (if no-dst
"1"
(if (eq day -1)
byday
(substring byday 0 -2))))
(substring byday 0 -2)))))
;; "Translate" the iCalendar way to specify the last
;; (sun|mon|...)day in month to the tzset way.
(if (string= week "-1") ; last day as iCalendar calls it
(setq week "5")) ; last day as tzset calls it
(when no-dst (setq bymonth "1"))
(concat "M" bymonth "." week "." (if (eq day -1) "0"
(int-to-string day))
;; Start time.
......@@ -526,7 +530,7 @@ The strings are suitable for assembling into a TZ variable."
":"
(substring dtstart -4 -2)
":"
(substring dtstart -2))))))))))
(substring dtstart -2)))))))))
(defun icalendar--parse-vtimezone (alist)
"Turn a VTIMEZONE ALIST into a cons (ID . TZ-STRING).
......@@ -1025,7 +1029,8 @@ FExport diary data into iCalendar file: ")
(found-error nil)
(nonmarker (concat "^" (regexp-quote diary-nonmarking-symbol)
"?"))
(other-elements nil))
(other-elements nil)
(cns-cons-or-list nil))
;; prepare buffer with error messages
(save-current-buffer
(set-buffer (get-buffer-create "*icalendar-errors*"))
......
2014-11-16 Ulf Jasper <ulf.jasper@web.de>
* automated/icalendar-tests.el (icalendar--parse-vtimezone): Add
testcase where offsets of standard time and daylight saving time
are equal.
(icalendar-real-world): Fix error in test case. Expected result
was wrong when offsets of standard time and daylight saving time
were equal.
2014-11-16 Fabián Ezequiel Gallina <fgallina@gnu.org>
* automated/python-tests.el
......
......@@ -232,6 +232,27 @@ END:VTIMEZONE
(should (string= "anothername, with a comma" (car result)))
(message (cdr result))
(should (string= "STD-02:00DST-03:00,M3.2.1/03:00:00,M10.2.1/04:00:00"
(cdr result)))
;; offsetfrom = offsetto
(setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
TZID:Kolkata\, Chennai\, Mumbai\, New Delhi
X-MICROSOFT-CDO-TZID:23
BEGIN:STANDARD
DTSTART:16010101T000000
TZOFFSETFROM:+0530
TZOFFSETTO:+0530
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010101T000000
TZOFFSETFROM:+0530
TZOFFSETTO:+0530
END:DAYLIGHT
END:VTIMEZONE
"))
(setq result (icalendar--parse-vtimezone vtimezone))
(should (string= "Kolkata, Chennai, Mumbai, New Delhi" (car result)))
(message (cdr result))
(should (string= "STD-05:30DST-05:30,M1.1.1/00:00:00,M1.1.1/00:00:00"
(cdr result)))))
(ert-deftest icalendar--convert-ordinary-to-ical ()
......@@ -1389,14 +1410,14 @@ END:VALARM
END:VEVENT
END:VCALENDAR"
nil
"&9/5/2003 10:30-15:30 On-Site Interview
"&9/5/2003 07:00-12:00 On-Site Interview
Desc: 10:30am - Blah
Location: Cccc
Organizer: MAILTO:aaaaaaa@aaaaaaa.com
Status: CONFIRMED
UID: 040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000010000000DB823520692542408ED02D7023F9DFF9
"
"&5/9/2003 10:30-15:30 On-Site Interview
"&5/9/2003 07:00-12:00 On-Site Interview
Desc: 10:30am - Blah
Location: Cccc
Organizer: MAILTO:aaaaaaa@aaaaaaa.com
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment