Commit 6d28421c authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

Get time zones right

parent babd5b8b
Pipeline #2295 failed with stage
in 80 minutes and 35 seconds
......@@ -174,15 +174,15 @@ well as variants like \"2008W32\" (week number) and
Return the number of minutes."
(if (not (iso8601--match iso8601--zone-match string))
(signal 'wrong-type-argument string)
(if (match-string 1 string)
(if (match-string 2 string)
;; HH:MM-ish.
(let ((hour (string-to-number (match-string 3 string)))
(minute (and (match-string 4 string)
(string-to-number (match-string 5 string)))))
(+ (* (if (equal (match-string 1 string) "-")
(- hour)
hour)
60
(string-to-number (match-string 4 string)))))
(* (if (equal (match-string 2 string) "-")
-1
1)
(+ (* hour 60)
(or minute 0))))
;; "Z".
0)))
......
......@@ -66,7 +66,13 @@
(ert-deftest test-iso8601-combined ()
(should (equal (iso8601-parse "2008-03-02T13:47:30")
'(30 47 13 2 3 2008 nil nil nil))))
'(30 47 13 2 3 2008 nil nil nil)))
(should (equal (iso8601-parse "2008-03-02T13:47:30Z")
'(30 47 13 2 3 2008 nil nil 0)))
(should (equal (iso8601-parse "2008-03-02T13:47:30+01:00")
'(30 47 13 2 3 2008 nil nil 3600)))
(should (equal (iso8601-parse "2008-03-02T13:47:30-01")
'(30 47 13 2 3 2008 nil nil -3600))))
(ert-deftest test-iso8601-duration ()
(should (equal (iso8601-parse-duration "P3Y6M4DT12H30M5S")
......
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