summaryrefslogtreecommitdiff
path: root/lisp/calendar/iso8601.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/calendar/iso8601.el')
-rw-r--r--lisp/calendar/iso8601.el31
1 files changed, 26 insertions, 5 deletions
diff --git a/lisp/calendar/iso8601.el b/lisp/calendar/iso8601.el
index f44ed3858f6..ab0077ac58d 100644
--- a/lisp/calendar/iso8601.el
+++ b/lisp/calendar/iso8601.el
@@ -21,13 +21,33 @@
;;; Commentary:
-;; For a publicly available version of the standards document, see:
-
+;; ISO8601 times basically look like 1985-04-01T15:23:49... Or so
+;; you'd think. This is what everybody means when they say "ISO8601",
+;; but it's in reality a quite large collection of syntaxes, including
+;; week numbers, ordinal dates, durations and intervals. This package
+;; has functions for parsing them all.
+;;
+;; The interface functions are `iso8601-parse', `iso8601-parse-date',
+;; `iso8601-parse-time', `iso8601-parse-zone',
+;; `iso8601-parse-duration' and `iso8601-parse-interval'. They all
+;; return decoded time objects, except the last one, which returns a
+;; list of three of them.
+;;
+;; (iso8601-parse-interval "P1Y2M10DT2H30M/2008W32T153000-01")
+;; '((0 0 13 24 5 2007 nil nil -3600)
+;; (0 30 15 3 8 2008 nil nil -3600)
+;; (0 30 2 10 2 1 nil nil nil))
+;;
+;;
+;; The standard can be found at:
+;;
;; http://www.loc.gov/standards/datetime/iso-tc154-wg5_n0038_iso_wd_8601-1_2016-02-16.pdf
-
+;;
;; The Wikipedia page on the standard is also informative:
-
+;;
;; https://en.wikipedia.org/wiki/ISO_8601
+;;
+;; RFC3339 defines the subset that everybody thinks of as "ISO8601".
;;; Code:
@@ -217,7 +237,8 @@ well as variants like \"2008W32\" (week number) and
:minute (or minute 0)
:second (or second 0)
:zone (and zone
- (iso8601-parse-zone zone))))))))
+ (* 60 (iso8601-parse-zone
+ zone)))))))))
(defun iso8601-parse-zone (string)
"Parse STRING, which should be an ISO 8601 time zone.