split into date, time partial parsing

This commit is contained in:
Aaron Raddon 2018-02-25 16:35:33 -08:00
parent ffccba6ba2
commit 13b1994d70
3 changed files with 995 additions and 871 deletions

View File

@ -13,6 +13,10 @@ go test -bench Parse
BenchmarkShotgunParse 50000 37588 ns/op 13258 B/op 167 allocs/op
BenchmarkDateparseParseAny 500000 5752 ns/op 0 B/op 0 allocs/op
// Aarons Laptop Lenovo 900 Feb 2018
BenchmarkShotgunParse-4 50000 30045 ns/op 13136 B/op 169 allocs/op
BenchmarkParseAny-4 200000 8627 ns/op 144 B/op 3 allocs/op
*/
func BenchmarkShotgunParse(b *testing.B) {
b.ReportAllocs()

File diff suppressed because it is too large Load Diff

View File

@ -222,6 +222,16 @@ func TestParse(t *testing.T) {
ts = MustParse("2 Feb 2006 19:17:22")
assert.Equal(t, "2006-02-02 19:17:22 +0000 UTC", fmt.Sprintf("%v", ts.In(time.UTC)))
// // 19 Dec 2013 12:15:23 GMT
// ts = MustParse("12 Feb 2006 19:17:22 GMT")
// assert.Equal(t, "2006-02-12 19:17:22 +0000 UTC", fmt.Sprintf("%v", ts.In(time.UTC)))
// ts = MustParse("2 Feb 2006 19:17:22 GMT")
// assert.Equal(t, "2006-02-02 19:17:22 +0000 UTC", fmt.Sprintf("%v", ts.In(time.UTC)))
// // 28 Mar 2010 15:45:30 +1100
// ts = MustParse("12 Feb 2006 19:17:22")
// assert.Equal(t, "2006-02-12 19:17:22 +0000 UTC", fmt.Sprintf("%v", ts.In(time.UTC)))
ts = MustParse("2013-Feb-03")
assert.Equal(t, "2013-02-03 00:00:00 +0000 UTC", fmt.Sprintf("%v", ts.In(time.UTC)))