]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix Icalendar export with ISO dates
authorEli Zaretskii <eliz@gnu.org>
Sat, 13 Apr 2024 07:52:55 +0000 (10:52 +0300)
committerEshel Yaron <me@eshelyaron.com>
Sun, 14 Apr 2024 17:09:42 +0000 (19:09 +0200)
* lisp/calendar/icalendar.el (icalendar--datestring-to-isodate):
Accept dashes in ISO-style numeric dates.  Patch by Erwan Hingant
<erwan.hingant@mailo.com>. (Bug#69894)

* test/lisp/calendar/icalendar-tests.el
(icalendar--datestring-to-isodate): Add a test for dashes in
ISO-style numeric dates.

(cherry picked from commit 71f8b2c3242b9b9455e9c6f25ad99ea900a1422f)

lisp/calendar/icalendar.el
test/lisp/calendar/icalendar-tests.el

index b8d5862f8c2078e8eb3ea82205c9fd34ae3bd332..e536a0bcf857b43fba4c4c6ab23d78fb02837bcf 100644 (file)
@@ -895,8 +895,8 @@ it uses the current calendar date style."
     (save-match-data
       (cond ( ;; iso-style numeric date
              (string-match (concat "\\s-*"
-                                   "\\([0-9]\\{4\\}\\)[ \t/]\\s-*"
-                                   "0?\\([1-9][0-9]?\\)[ \t/]\\s-*"
+                                   "\\([0-9]\\{4\\}\\)[ \t/-]\\s-*"
+                                   "0?\\([1-9][0-9]?\\)[ \t/-]\\s-*"
                                    "0?\\([1-9][0-9]?\\)")
                            datestring)
              (setq year (read (substring datestring (match-beginning 1)
index 39ad735a7897f8c2953183415ee50614906e14a6..32c06cbc533bc76b894c325826e1fe8de3c2a54c 100644 (file)
@@ -368,6 +368,9 @@ END:VTIMEZONE
                     (icalendar--datestring-to-isodate "2008 05 31")))
     (should (string= "20080602"
                     (icalendar--datestring-to-isodate "2008 05 31" 2)))
+    ;; Bug#69894
+    (should (string= "20240319"
+                    (icalendar--datestring-to-isodate "2024-03-19")))
 
     ;; numeric european
     (setq calendar-date-style 'european)