Allow space to separate date and time (#300)

Fixes #231
This commit is contained in:
Marcin Białoń
2019-09-19 19:45:53 +02:00
committed by Thomas Pelletier
parent ec312409d3
commit 095a905e04
4 changed files with 22 additions and 2 deletions
+5 -1
View File
@@ -313,7 +313,11 @@ func (p *tomlParser) parseRvalue() interface{} {
}
return val
case tokenDate:
val, err := time.ParseInLocation(time.RFC3339Nano, tok.val, time.UTC)
layout := time.RFC3339Nano
if !strings.Contains(tok.val, "T") {
layout = strings.Replace(layout, "T", " ", 1)
}
val, err := time.ParseInLocation(layout, tok.val, time.UTC)
if err != nil {
p.raiseError(tok, "%s", err)
}