2
0
mirror of https://github.com/araddon/dateparse.git synced 2025-10-26 16:26:14 +08:00

new date format

This commit is contained in:
Aaron Raddon
2015-06-25 14:09:39 -07:00
parent 33ad15a3c7
commit 0dca814ad3
2 changed files with 13 additions and 0 deletions

View File

@@ -137,6 +137,7 @@ iterRunes:
}
case ST_DIGITDASHT: // starts digit then dash 02- then T
// 2006-01-02T15:04:05Z07:00
// 2006-01-02T15:04:05
// 2006-01-02T15:04:05.999999999Z07:00
// 2006-01-02T15:04:05.999999999Z
// 2006-01-02T15:04:05.99999999Z
@@ -158,6 +159,13 @@ iterRunes:
} else {
return time.Time{}, err
}
} else if len(datestr) == len("2006-01-02T15:04:05") {
if t, err := time.Parse("2006-01-02T15:04:05", datestr); err == nil {
u.Errorf("wat? %v", t)
return t, nil
} else {
return time.Time{}, err
}
} else {
// updated to include timestamps of different precisions
if t, err := time.Parse("2006-01-02T15:04:05.999999999Z", datestr); err == nil {