unmarshal: support lowercase 'T' and 'Z' in date-time parsing (#601)

RFC3399 allows for lowercase 't' and 'z' in date-time values.

Fixes #600
This commit is contained in:
Cameron Moore
2021-09-25 12:02:23 -05:00
committed by GitHub
parent ee9b902222
commit 476492a85c
3 changed files with 11 additions and 4 deletions
+2 -2
View File
@@ -75,7 +75,7 @@ func parseDateTime(b []byte) (time.Time, error) {
panic("date time should have a timezone")
}
if b[0] == 'Z' {
if b[0] == 'Z' || b[0] == 'z' {
b = b[1:]
zone = time.UTC
} else {
@@ -127,7 +127,7 @@ func parseLocalDateTime(b []byte) (LocalDateTime, []byte, error) {
dt.LocalDate = date
sep := b[10]
if sep != 'T' && sep != ' ' {
if sep != 'T' && sep != ' ' && sep != 't' {
return dt, nil, newDecodeError(b[10:11], "datetime separator is expected to be T or a space")
}