1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-24 07:20:37 +00:00

Fix Icalendar export with ISO dates

* 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.
This commit is contained in:
Eli Zaretskii 2024-04-13 10:52:55 +03:00
parent 4fc3771078
commit 71f8b2c324
2 changed files with 5 additions and 2 deletions

View 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)

View 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)