]> git.eshelyaron.com Git - emacs.git/commitdiff
icalendar: fix issues regarding timezones without dst
authorUlf Jasper <ulf.jasper@web.de>
Sun, 16 Nov 2014 16:23:45 +0000 (17:23 +0100)
committerUlf Jasper <ulf.jasper@web.de>
Sun, 16 Nov 2014 16:23:45 +0000 (17:23 +0100)
* 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
lisp/calendar/icalendar.el
test/ChangeLog
test/automated/icalendar-tests.el

index bdf73e827d106261b270fa4c8925017e5dcd43ba..9d22d7609e228c005fb9331ea290801bcd563ad7 100644 (file)
@@ -1,3 +1,10 @@
+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
index b024a38f8095c7c8c62f4086add967f9740fd06f..9dba6ff2dcf937dde40d02e2478d0dd1596cac32 100644 (file)
@@ -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*"))
index e0e04bc262cab30eee4945c601f4f5cc5c228038..4a6f0059344fac5d897338e4969b8a47826cd1fb 100644 (file)
@@ -1,3 +1,12 @@
+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
index a6a5da2ff576d36b9904a0ffab46847a26c0805f..23afb14792df877add263d064e05ec60b9be6c23 100644 (file)
@@ -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