aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2020-01-30 03:02:48 +0100
committerLars Ingebrigtsen2020-01-30 03:02:48 +0100
commit1ed7cd41dba444da0b66427eb48852e896ca3742 (patch)
treee83a624096cabea9f483412788d41b2b1763ec19
parent7c7b91b9fe156b6af4643ca4aa8f4a5c4aeb915f (diff)
downloademacs-1ed7cd41dba444da0b66427eb48852e896ca3742.tar.gz
emacs-1ed7cd41dba444da0b66427eb48852e896ca3742.zip
Give fuller support for obsolete ---12 dates in iso8601
* lisp/calendar/iso8601.el (iso8601--outdated-reduced-precision-date-match): New constant. (iso8601--date-match): Use it.
-rw-r--r--lisp/calendar/iso8601.el3
-rw-r--r--test/lisp/calendar/iso8601-tests.el10
2 files changed, 10 insertions, 3 deletions
diff --git a/lisp/calendar/iso8601.el b/lisp/calendar/iso8601.el
index 858d561f188..906c29b15f4 100644
--- a/lisp/calendar/iso8601.el
+++ b/lisp/calendar/iso8601.el
@@ -69,6 +69,8 @@
69 "\\([+-]?[0-9][0-9][0-9][0-9]\\)-\\([0-9][0-9]\\)") 69 "\\([+-]?[0-9][0-9][0-9][0-9]\\)-\\([0-9][0-9]\\)")
70(defconst iso8601--outdated-date-match 70(defconst iso8601--outdated-date-match
71 "--\\([0-9][0-9]\\)-?\\([0-9][0-9]\\)") 71 "--\\([0-9][0-9]\\)-?\\([0-9][0-9]\\)")
72(defconst iso8601--outdated-reduced-precision-date-match
73 "---?\\([0-9][0-9]\\)")
72(defconst iso8601--week-date-match 74(defconst iso8601--week-date-match
73 "\\([+-]?[0-9][0-9][0-9][0-9]\\)-?W\\([0-9][0-9]\\)-?\\([0-9]\\)?") 75 "\\([+-]?[0-9][0-9][0-9][0-9]\\)-?W\\([0-9][0-9]\\)-?\\([0-9]\\)?")
74(defconst iso8601--ordinal-date-match 76(defconst iso8601--ordinal-date-match
@@ -79,6 +81,7 @@
79 iso8601--full-date-match 81 iso8601--full-date-match
80 iso8601--without-day-match 82 iso8601--without-day-match
81 iso8601--outdated-date-match 83 iso8601--outdated-date-match
84 iso8601--outdated-reduced-precision-date-match
82 iso8601--week-date-match 85 iso8601--week-date-match
83 iso8601--ordinal-date-match))) 86 iso8601--ordinal-date-match)))
84 87
diff --git a/test/lisp/calendar/iso8601-tests.el b/test/lisp/calendar/iso8601-tests.el
index c2994ef8b4d..e8b155a7aa7 100644
--- a/test/lisp/calendar/iso8601-tests.el
+++ b/test/lisp/calendar/iso8601-tests.el
@@ -47,10 +47,14 @@
47(ert-deftest test-iso8601-date-obsolete-2000 () 47(ert-deftest test-iso8601-date-obsolete-2000 ()
48 ;; These are forms in 5.2.1.3 of the 2000 version of the standard, 48 ;; These are forms in 5.2.1.3 of the 2000 version of the standard,
49 ;; e) and f). 49 ;; e) and f).
50 (should (equal (iso8601-parse-date "--02") 50 (should (equal (iso8601-parse-date "--12")
51 '(nil nil nil nil 2 nil nil -1 nil))) 51 '(nil nil nil nil 12 nil nil -1 nil)))
52 (should (equal (iso8601-parse "--12T14")
53 '(0 0 14 nil 12 nil nil -1 nil)))
52 (should (equal (iso8601-parse-date "---12") 54 (should (equal (iso8601-parse-date "---12")
53 '(nil nil nil 12 nil nil nil -1 nil)))) 55 '(nil nil nil 12 nil nil nil -1 nil)))
56 (should (equal (iso8601-parse "---12T14:10:12")
57 '(12 10 14 12 nil nil nil -1 nil))))
54 58
55(ert-deftest test-iso8601-date-weeks () 59(ert-deftest test-iso8601-date-weeks ()
56 (should (equal (iso8601-parse-date "2008W39-6") 60 (should (equal (iso8601-parse-date "2008W39-6")