diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-06-28 23:23:44 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-06-28 23:23:44 +0200 |
commit | aab5707fc6c2d7faa74d051b1ba3aa2b43a51e4d (patch) | |
tree | 1a92c8e23cb41d39d397b551d9bd66feb1989a63 /module | |
parent | Change calling for find-min. (diff) | |
download | calp-aab5707fc6c2d7faa74d051b1ba3aa2b43a51e4d.tar.gz calp-aab5707fc6c2d7faa74d051b1ba3aa2b43a51e4d.tar.xz |
Add parse-iso-datetime.
Diffstat (limited to '')
-rw-r--r-- | module/datetime.scm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/module/datetime.scm b/module/datetime.scm index ed06f0c8..2c0972ea 100644 --- a/module/datetime.scm +++ b/module/datetime.scm @@ -707,6 +707,15 @@ tz: ,(and (string= "Z" (string-take-right str 1)) "UTC")))) +(define-public (parse-iso-datetime str) + (let* (((date time) (string-split str #\T))) + (when (string= "Z" (string-take-right str 1)) + (set! time (string-drop-right time 1))) + (datetime date: (parse-iso-date date) + time: (parse-iso-time time) + tz: (and (string= "Z" (string-take-right str 1)) + "UTC")))) + (define (date-reader chr port) (unread-char chr port) (let ((line (symbol->string (read port)))) |