Commit 3769ea22 authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

Add some commentary

parent 1af666c6
Pipeline #2642 failed with stage
in 60 minutes and 15 seconds
...@@ -21,13 +21,33 @@ ...@@ -21,13 +21,33 @@
;;; Commentary: ;;; 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 ;; 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: ;; The Wikipedia page on the standard is also informative:
;;
;; https://en.wikipedia.org/wiki/ISO_8601 ;; https://en.wikipedia.org/wiki/ISO_8601
;;
;; RFC3339 defines the subset that everybody thinks of as "ISO8601".
;;; Code: ;;; Code:
...@@ -217,7 +237,8 @@ well as variants like \"2008W32\" (week number) and ...@@ -217,7 +237,8 @@ well as variants like \"2008W32\" (week number) and
:minute (or minute 0) :minute (or minute 0)
:second (or second 0) :second (or second 0)
:zone (and zone :zone (and zone
(iso8601-parse-zone zone)))))))) (* 60 (iso8601-parse-zone
zone)))))))))
(defun iso8601-parse-zone (string) (defun iso8601-parse-zone (string)
"Parse STRING, which should be an ISO 8601 time zone. "Parse STRING, which should be an ISO 8601 time zone.
......
...@@ -189,24 +189,24 @@ ...@@ -189,24 +189,24 @@
(ert-deftest standard-test-time-of-day-zone () (ert-deftest standard-test-time-of-day-zone ()
(should (equal (iso8601-parse-time "152746+0100") (should (equal (iso8601-parse-time "152746+0100")
'(46 27 15 nil nil nil nil nil 60))) '(46 27 15 nil nil nil nil nil 3600)))
(should (equal (iso8601-parse-time "15:27:46+0100") (should (equal (iso8601-parse-time "15:27:46+0100")
'(46 27 15 nil nil nil nil nil 60))) '(46 27 15 nil nil nil nil nil 3600)))
(should (equal (iso8601-parse-time "152746+01") (should (equal (iso8601-parse-time "152746+01")
'(46 27 15 nil nil nil nil nil 60))) '(46 27 15 nil nil nil nil nil 3600)))
(should (equal (iso8601-parse-time "15:27:46+01") (should (equal (iso8601-parse-time "15:27:46+01")
'(46 27 15 nil nil nil nil nil 60))) '(46 27 15 nil nil nil nil nil 3600)))
(should (equal (iso8601-parse-time "152746-0500") (should (equal (iso8601-parse-time "152746-0500")
'(46 27 15 nil nil nil nil nil -300))) '(46 27 15 nil nil nil nil nil -18000)))
(should (equal (iso8601-parse-time "15:27:46-0500") (should (equal (iso8601-parse-time "15:27:46-0500")
'(46 27 15 nil nil nil nil nil -300))) '(46 27 15 nil nil nil nil nil -18000)))
(should (equal (iso8601-parse-time "152746-05") (should (equal (iso8601-parse-time "152746-05")
'(46 27 15 nil nil nil nil nil -300))) '(46 27 15 nil nil nil nil nil -18000)))
(should (equal (iso8601-parse-time "15:27:46-05") (should (equal (iso8601-parse-time "15:27:46-05")
'(46 27 15 nil nil nil nil nil -300)))) '(46 27 15 nil nil nil nil nil -18000))))
(ert-deftest standard-test-date-and-time-of-day () (ert-deftest standard-test-date-and-time-of-day ()
(should (equal (iso8601-parse "19850412T101530") (should (equal (iso8601-parse "19850412T101530")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment