[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117656: Fix Bug#15408 (icalendar time zone problem)
From: |
Ulf Jasper |
Subject: |
[Emacs-diffs] trunk r117656: Fix Bug#15408 (icalendar time zone problem) |
Date: |
Wed, 06 Aug 2014 18:19:41 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117656
revision-id: address@hidden
parent: address@hidden
committer: Ulf Jasper <address@hidden>
branch nick: trunk
timestamp: Wed 2014-08-06 20:19:34 +0200
message:
Fix Bug#15408 (icalendar time zone problem)
2014-07-30 Christophe Deleuze <address@hidden>
* calendar/icalendar.el (icalendar--decode-isodatetime): Use
actual current-time-zone when converting to local time. (Bug#15408)
2014-07-30 Ulf Jasper <address@hidden>
* automated/icalendar-tests.el (icalendar--decode-isodatetime): New
test.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/calendar/icalendar.el
icalendar.el-20091113204419-o5vbwnq5f7feedwu-3296
test/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-8588
test/automated/icalendar-tests.el
icalendartestsuite.e-20091113204419-o5vbwnq5f7feedwu-8590
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2014-08-05 19:01:51 +0000
+++ b/lisp/ChangeLog 2014-08-06 18:19:34 +0000
@@ -1,3 +1,10 @@
+2014-08-06 Ulf Jasper <address@hidden>
+
+ * calendar/icalendar.el (icalendar--diarytime-to-isotime):
+ (icalendar--convert-ordinary-to-ical): Allow for missing minutes
+ (Bug#13750).
+
+
2014-08-05 Lars Magne Ingebrigtsen <address@hidden>
* image-mode.el (image-toggle-display-image): Always rescale images
=== modified file 'lisp/calendar/icalendar.el'
--- a/lisp/calendar/icalendar.el 2014-07-30 16:25:58 +0000
+++ b/lisp/calendar/icalendar.el 2014-08-06 18:19:34 +0000
@@ -896,10 +896,16 @@
(defun icalendar--diarytime-to-isotime (timestring ampmstring)
"Convert a time like 9:30pm to an iso-conform string like T213000.
-In this example the TIMESTRING would be \"9:30\" and the AMPMSTRING
-would be \"pm\"."
+In this example the TIMESTRING would be \"9:30\" and the
+AMPMSTRING would be \"pm\". The minutes may be missing as long
+as the colon is missing as well, i.e. \"9\" is allowed as
+TIMESTRING and has the same result as \"9:00\"."
(if timestring
- (let ((starttimenum (read (icalendar--rris ":" "" timestring))))
+ (let* ((parts (save-match-data (split-string timestring ":")))
+ (h (car parts))
+ (m (if (cdr parts) (cadr parts)
+ (if (> (length h) 2) "" "00")))
+ (starttimenum (read (concat h m))))
;; take care of am/pm style
;; Be sure *not* to convert 12:00pm - 12:59pm to 2400-2459
(if (and ampmstring (string= "pm" ampmstring) (< starttimenum 1200))
@@ -1231,9 +1237,9 @@
(if (string-match
(concat nonmarker
"\\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\)\\s-*" ; date
- "\\(\\([0-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?" ; start time
+ "\\(\\([0-9][0-9]?\\(:[0-9][0-9]\\)?\\)\\([ap]m\\)?" ; start
time
"\\("
- "-\\([0-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?" ; end time
+ "-\\([0-9][0-9]?\\(:[0-9][0-9]\\)?\\)\\([ap]m\\)?\\)?" ; end
time
"\\)?"
"\\s-*\\(.*?\\) ?$")
entry-main)
@@ -1250,25 +1256,25 @@
(match-beginning 3)
(match-end 3))
nil)
- (if (match-beginning 4)
+ (if (match-beginning 5)
(substring entry-main
- (match-beginning 4)
- (match-end 4))
+ (match-beginning 5)
+ (match-end 5))
nil)))
(endtimestring (icalendar--diarytime-to-isotime
- (if (match-beginning 6)
- (substring entry-main
- (match-beginning 6)
- (match-end 6))
- nil)
(if (match-beginning 7)
(substring entry-main
(match-beginning 7)
(match-end 7))
+ nil)
+ (if (match-beginning 9)
+ (substring entry-main
+ (match-beginning 9)
+ (match-end 9))
nil)))
(summary (icalendar--convert-string-for-export
- (substring entry-main (match-beginning 8)
- (match-end 8)))))
+ (substring entry-main (match-beginning 10)
+ (match-end 10)))))
(icalendar--dmsg "ordinary %s" entry-main)
(unless startisostring
=== modified file 'test/ChangeLog'
--- a/test/ChangeLog 2014-08-03 20:34:33 +0000
+++ b/test/ChangeLog 2014-08-06 18:19:34 +0000
@@ -1,3 +1,9 @@
+2014-08-06 Ulf Jasper <address@hidden>
+
+ * automated/icalendar-tests.el
+ (icalendar--convert-ordinary-to-ical),
+ (icalendar--diarytime-to-isotime): More testcases (Bug#13750).
+
2014-08-03 Glenn Morris <address@hidden>
* automated/Makefile.in (check-tar): New rule.
=== modified file 'test/automated/icalendar-tests.el'
--- a/test/automated/icalendar-tests.el 2014-08-02 05:44:18 +0000
+++ b/test/automated/icalendar-tests.el 2014-08-06 18:19:34 +0000
@@ -220,6 +220,15 @@
(car result)))
(should (string= "subject" (cadr result)))
+ ;; with start time
+ (setq result (icalendar--convert-ordinary-to-ical
+ "&?" "&2010 2 15 12:34 s"))
+ (should (= 2 (length result)))
+ (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T123400"
+ "\nDTEND;VALUE=DATE-TIME:20100215T133400")
+ (car result)))
+ (should (string= "s" (cadr result)))
+
;; with time
(setq result (icalendar--convert-ordinary-to-ical
"&?" "&2010 2 15 12:34-23:45 s"))
@@ -267,7 +276,9 @@
(should (string= "T120100"
(icalendar--diarytime-to-isotime "1201" "pm")))
(should (string= "T125900"
- (icalendar--diarytime-to-isotime "1259" "pm"))))
+ (icalendar--diarytime-to-isotime "1259" "pm")))
+ (should (string= "T150000"
+ (icalendar--diarytime-to-isotime "3" "pm"))))
(ert-deftest icalendar--datetime-to-diary-date ()
"Test method for `icalendar--datetime-to-diary-date'."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117656: Fix Bug#15408 (icalendar time zone problem),
Ulf Jasper <=