diff --git a/go.sum b/go.sum index 40bf744..370a49d 100644 --- a/go.sum +++ b/go.sum @@ -8,7 +8,6 @@ github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/scylladb/termtables v0.0.0-20191203121021-c4c0b6d42ff4 h1:8qmTC5ByIXO3GP/IzBkxcZ/99VITvnIETDhdFz/om7A= github.com/scylladb/termtables v0.0.0-20191203121021-c4c0b6d42ff4/go.mod h1:C1a7PQSMz9NShzorzCiG2fk9+xuCgLkPeCvMHYR2OWg= -github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= diff --git a/parseany.go b/parseany.go index b9668b2..52e7461 100644 --- a/parseany.go +++ b/parseany.go @@ -368,7 +368,10 @@ iterRunes: // 08.21.71 // 2014.05 p.stateDate = dateDigitDot - if i == 4 { + if i == 10 && len(datestr) <= 14 { + p.stateDate = dateDigit + datestr = datestr[:10] + datestr[11:] + "000"[:14 - len(datestr)] + } else if i == 4 { p.yearlen = i p.moi = i + 1 p.setYear() diff --git a/parseany_test.go b/parseany_test.go index 7fea1e6..be8cced 100644 --- a/parseany_test.go +++ b/parseany_test.go @@ -412,6 +412,10 @@ var testInputs = []dateTest{ {in: "171113 14:14:20", out: "2017-11-13 14:14:20 +0000 UTC"}, // all digits: unix secs, ms etc + {in: "1332151919.329", out: "2012-03-19 10:11:59.329 +0000 UTC"}, + {in: "1332151919.32", out: "2012-03-19 10:11:59.32 +0000 UTC"}, + {in: "1332151919.", out: "2012-03-19 10:11:59 +0000 UTC"}, + {in: "1332151919.001", out: "2012-03-19 10:11:59.001 +0000 UTC"}, {in: "1332151919", out: "2012-03-19 10:11:59 +0000 UTC"}, {in: "1332151919", out: "2012-03-19 10:11:59 +0000 UTC", loc: "America/Denver"}, {in: "1384216367111", out: "2013-11-12 00:32:47.111 +0000 UTC"},