Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

time: Parse lacks Y10K support #31981

Closed
BenLubar opened this issue May 11, 2019 · 4 comments
Closed

time: Parse lacks Y10K support #31981

BenLubar opened this issue May 11, 2019 · 4 comments

Comments

@BenLubar
Copy link

@BenLubar BenLubar commented May 11, 2019

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

$ go version
go version go1.12.5 linux/amd64

Does this issue reproduce with the latest release?

yes

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

go env Output
$ go env
GOARCH="amd64"
GOBIN="/home/ben/go/bin"
GOCACHE="/home/ben/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ben/.golang-path:/home/ben/go"
GOPROXY=""
GORACE=""
GOROOT="/home/ben/.gimme/versions/go1.12.5.linux.amd64"
GOTMPDIR=""
GOTOOLDIR="/home/ben/.gimme/versions/go1.12.5.linux.amd64/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build930211599=/tmp/go-build -gno-record-gcc-switches"

What did you do?

https://play.golang.org/p/UKFjYzeIFA0

What did you expect to see?

10000-01-01
success 10000-01-01 00:00:00 +0000 UTC

What did you see instead?

10000-01-01
error parsing time "10000-01-01" as "2006-01-02": cannot parse "0-01-01" as "-"
@ianlancetaylor ianlancetaylor changed the title time.Parse lacks Y10K support time: Parse lacks Y10K support May 11, 2019
@ianlancetaylor ianlancetaylor added this to the Unplanned milestone May 11, 2019
@jamdagni86
Copy link
Contributor

@jamdagni86 jamdagni86 commented May 13, 2019

@ianlancetaylor the reason this is failing is the code expects years of length 4 (time/format.go:parse). fix is to look for the position of the first occurrence of hyphen instead of the hardcoded value (4). let me know if this needs to be fixed though.

@rsc
Copy link
Contributor

@rsc rsc commented May 13, 2019

We can probably put off trying to fix this until the year 9000. I'm confident 1000 years of lead time will be long enough. Please reopen or refile then. Thanks.

@rsc rsc closed this May 13, 2019
@BenLubar
Copy link
Author

@BenLubar BenLubar commented May 13, 2019

Alright, I will check back in 6981 years.

@rsc
Copy link
Contributor

@rsc rsc commented May 13, 2019

Thanks!

@golang golang locked and limited conversation to collaborators May 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.