Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
5 changes: 4 additions & 1 deletion parseany.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions parseany_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down