Skip to content

Commit fce9fcf

Browse files
committed
Support whitespace between date and time component
1 parent b9fe72e commit fce9fcf

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

iso8601.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ parse:
164164
return time.Time{}, err
165165
}
166166
break parse
167-
case 'T':
167+
case 'T', ' ':
168168
if p != day {
169169
return time.Time{}, newUnexpectedCharacterError(inp[i])
170170
}

iso8601_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,18 @@ var cases = []TestCase{
299299
MilliSecond: 0,
300300
Zone: 0,
301301
},
302+
{
303+
Using: "2017-04-24 09:41:34",
304+
Year: 2017, Month: 4, Day: 24,
305+
Hour: 9, Minute: 41, Second: 34,
306+
},
307+
{
308+
Using: "2017-04-24 09:41:34.502+00:00",
309+
Year: 2017, Month: 4, Day: 24,
310+
Hour: 9, Minute: 41, Second: 34,
311+
MilliSecond: 502,
312+
Zone: 0,
313+
},
302314

303315
// Invalid Parse Test Cases
304316
{

0 commit comments

Comments
 (0)