diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | module/srfi/srfi-19.scm | 2 | ||||
-rw-r--r-- | test-suite/tests/srfi-19.test | 3 |
3 files changed, 6 insertions, 0 deletions
@@ -54,6 +54,7 @@ This speeds up copying large files a lot while saving the disk space. (<https://bugs.gnu.org/55344>) ** 'make-custom-port' now honors its #:conversion-strategy argument ** 'eval-string' respects #:column (previously it was set to the #:line) +** 'string->date' now allows a colon in the ISO 8601 zone offset ** Hashing of UTF-8 symbols with non-ASCII characters avoids corruption (<https://bugs.gnu.org/56413>) diff --git a/module/srfi/srfi-19.scm b/module/srfi/srfi-19.scm index 570f933ca..d809ac1ec 100644 --- a/module/srfi/srfi-19.scm +++ b/module/srfi/srfi-19.scm @@ -1268,6 +1268,8 @@ (set! offset (+ offset (* (char->int ch) 60 60)))) (let ((ch (read-char port))) + (if (eqv? ch #\:) + (set! ch (read-char port))) (if (eof-object? ch) (time-error 'string->date 'bad-date-template-string (list "Invalid time zone number" ch))) diff --git a/test-suite/tests/srfi-19.test b/test-suite/tests/srfi-19.test index 1d56214e4..55eb82320 100644 --- a/test-suite/tests/srfi-19.test +++ b/test-suite/tests/srfi-19.test @@ -120,6 +120,9 @@ incomplete numerical tower implementation.)" (pass-if "string->date works" (begin (string->date "2001-06-01@14:00" "~Y-~m-~d@~H:~M") #t)) + (pass-if "string->date accepts ISO 8601 zones with a colon" + (begin (string->date "2024-12-31T23:59:59+01:00" "~Y-~m-~dT~H:~M:~S~z") + #t)) ;; check for code paths where reals were passed to quotient, which ;; doesn't work in Guile (and is unspecified in R5RS) (test-time->date time-utc->date date->time-utc) |