blob: 4ffe3f881e3d1c027e22eb572b5deb2db964b0b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
From 833bea44b0f87b96833a97877c55c887ef43fb91 Mon Sep 17 00:00:00 2001
From: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Date: Thu, 29 Feb 2024 22:23:43 +0100
Subject: [PATCH] SRFI-19: Add support for ISO 8601 zones with a colon.
* module/srfi/srfi-19.scm (zone-reader): handle a colon in the zone.
* test-suite/tests/srfi-19.test (SRFI date/time library test): Add test.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
[rlb@defaultvalue.org: adjust commit message; add NEWS]
[GNUtoo: backported on top of v3.0.8 by removing the change in the NEWS file]
---
module/srfi/srfi-19.scm | 2 ++
test-suite/tests/srfi-19.test | 3 +++
2 files changed, 5 insertions(+)
diff --git a/module/srfi/srfi-19.scm b/module/srfi/srfi-19.scm
index 948a34eef..08bed71b4 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)
--
2.41.0
|