Skip to content

time: Parse does not detect bad days ("00" -> returns wrong date && err=nil) #17874

@larsklingsten

Description

@larsklingsten

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.7.3 darwin/amd64

What operating system and processor architecture are you using (go env)?

OARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/larsklingsten/source/golang"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.7.3/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.7.3/libexec/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/qc/2q_p2_zd32g_2lz3v5w8yclw0000gn/T/go-build111275672=/tmp/go-build -gno-record-gcc-switches -fno-co
mmon"
CXX="clang++"
CGO_ENABLED="1"

What did you do?

v, err := time.Parse("02.01.2006", "00.01.1970")
fmt.Println(v, err)

// see -> https://play.golang.org/p/FvCKKNbPK5

What did you expect to see?

0001-01-01 00:00:00 +0000 UTC

What did you see instead?

1969-12-31 00:00:00 +0000 UTC

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions