[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] [emacs] 01/01: icalendar: fix issues regarding timezones w
From: |
Ulf Jasper |
Subject: |
[Emacs-diffs] [emacs] 01/01: icalendar: fix issues regarding timezones without dst |
Date: |
Sun, 16 Nov 2014 16:25:17 +0000 |
u11 pushed a commit to branch master
in repository emacs.
commit 7261b4d9b2f35c3e520b488a8ba3cfde30f84a24
Author: Ulf Jasper <address@hidden>
Date: Sun Nov 16 17:23:45 2014 +0100
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.
---
lisp/ChangeLog | 7 +++++++
lisp/calendar/icalendar.el | 17 +++++++++++------
test/ChangeLog | 9 +++++++++
test/automated/icalendar-tests.el | 25 +++++++++++++++++++++++--
4 files changed, 50 insertions(+), 8 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index bdf73e8..9d22d76 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2014-11-16 Ulf Jasper <address@hidden>
+
+ * 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 <address@hidden>
* progmodes/python.el (run-python): Allow CMD to be optional and
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el
index b024a38..9dba6ff 100644
--- a/lisp/calendar/icalendar.el
+++ b/lisp/calendar/icalendar.el
@@ -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*"))
diff --git a/test/ChangeLog b/test/ChangeLog
index e0e04bc..4a6f005 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,12 @@
+2014-11-16 Ulf Jasper <address@hidden>
+
+ * 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 <address@hidden>
* automated/python-tests.el
diff --git a/test/automated/icalendar-tests.el
b/test/automated/icalendar-tests.el
index a6a5da2..23afb14 100644
--- a/test/automated/icalendar-tests.el
+++ b/test/automated/icalendar-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:address@hidden
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:address@hidden