Handle more date formats
This commit is contained in:
parent
462b4a2642
commit
efac11e082
2 changed files with 6 additions and 0 deletions
|
@ -203,6 +203,11 @@ func Parse(ds string) (t time.Time, err error) {
|
|||
}
|
||||
}
|
||||
|
||||
lastSpace := strings.LastIndex(ds, " ")
|
||||
if lastSpace > 0 {
|
||||
return Parse(ds[0:lastSpace])
|
||||
}
|
||||
|
||||
err = fmt.Errorf(`date parser: failed to parse date "%s"`, ds)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ func TestParseWeirdDateFormat(t *testing.T) {
|
|||
"9 Dec 2016 12:00 GMT",
|
||||
"Friday, December 22, 2017 - 3:09pm",
|
||||
"Friday, December 8, 2017 - 3:07pm",
|
||||
"Thu, 25 Feb 2016 00:00:00 Europe/Brussels",
|
||||
}
|
||||
|
||||
for _, date := range dates {
|
||||
|
|
Loading…
Reference in a new issue