Skip to content

20/5/2006 19:51:45 produces an error month out of range #105

@asannikov

Description

@asannikov

I added test case:
{in: "20/5/2006 19:51:45", out: "2006-05-20 19:51:45 +0000 UTC"},
and it's failed with an error:

❯ go test -cover
--- FAIL: TestParse (0.00s)
panic: parsing time "20/5/2006 19:51:45": month out of range [recovered]
        panic: parsing time "20/5/2006 19:51:45": month out of range

goroutine 20 [running]:
testing.tRunner.func1.1(0x12d1680, 0xc000099000)
        /usr/local/go/src/testing/testing.go:941 +0x3d0
testing.tRunner.func1(0xc0000d0900)
        /usr/local/go/src/testing/testing.go:944 +0x3f9
panic(0x12d1680, 0xc000099000)
        /usr/local/go/src/runtime/panic.go:967 +0x166
..../golang/dateparse.MustParse(0x1343561, 0x12, 0x0, 0x0, 0x12e3d20)
..../golang/dateparse/parseany.go:177 +0xfe
..../golang/dateparse.TestParse(0xc0000d0900)
..../golang/dateparse/parseany_test.go:60 +0xb10
testing.tRunner(0xc0000d0900, 0x1357e08)
        /usr/local/go/src/testing/testing.go:992 +0xdc
created by testing.(*T).Run
        /usr/local/go/src/testing/testing.go:1043 +0x357
exit status 2
FAIL    ..../golang/dateparse        0.350s

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions