[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 7c7b91b: Make iso8601.el understand two obsolete forms
From: |
Lars Ingebrigtsen |
Subject: |
master 7c7b91b: Make iso8601.el understand two obsolete forms |
Date: |
Wed, 29 Jan 2020 20:11:21 -0500 (EST) |
branch: master
commit 7c7b91b9fe156b6af4643ca4aa8f4a5c4aeb915f
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
Make iso8601.el understand two obsolete forms
* lisp/calendar/iso8601.el (iso8601-parse-date): Understand some
obsolete formats to provide compatibility with the vCard RFC
(bug#39347).
---
lisp/calendar/iso8601.el | 6 ++++++
test/lisp/calendar/iso8601-tests.el | 8 ++++++++
2 files changed, 14 insertions(+)
diff --git a/lisp/calendar/iso8601.el b/lisp/calendar/iso8601.el
index e42fe0f..858d561 100644
--- a/lisp/calendar/iso8601.el
+++ b/lisp/calendar/iso8601.el
@@ -202,6 +202,12 @@ See `decode-time' for the meaning of FORM."
(iso8601--decoded-time :year year
:month (decoded-time-month month-day)
:day (decoded-time-day month-day))))
+ ;; Obsolete format with implied year: --MM
+ ((iso8601--match "--\\([0-9][0-9]\\)" string)
+ (iso8601--decoded-time :month (string-to-number (match-string 1 string))))
+ ;; Obsolete format with implied year and month: ---DD
+ ((iso8601--match "---\\([0-9][0-9]\\)" string)
+ (iso8601--decoded-time :day (string-to-number (match-string 1 string))))
(t
(signal 'wrong-type-argument string))))
diff --git a/test/lisp/calendar/iso8601-tests.el
b/test/lisp/calendar/iso8601-tests.el
index 6e7a472..c2994ef 100644
--- a/test/lisp/calendar/iso8601-tests.el
+++ b/test/lisp/calendar/iso8601-tests.el
@@ -44,6 +44,14 @@
(should (equal (iso8601-parse-date "--0201")
'(nil nil nil 1 2 nil nil -1 nil))))
+(ert-deftest test-iso8601-date-obsolete-2000 ()
+ ;; These are forms in 5.2.1.3 of the 2000 version of the standard,
+ ;; e) and f).
+ (should (equal (iso8601-parse-date "--02")
+ '(nil nil nil nil 2 nil nil -1 nil)))
+ (should (equal (iso8601-parse-date "---12")
+ '(nil nil nil 12 nil nil nil -1 nil))))
+
(ert-deftest test-iso8601-date-weeks ()
(should (equal (iso8601-parse-date "2008W39-6")
'(nil nil nil 27 9 2008 nil -1 nil)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 7c7b91b: Make iso8601.el understand two obsolete forms,
Lars Ingebrigtsen <=