Skip to content

time: time.ParseInLocation can get the seconds wrong #71444

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

Closed
bbp-brieuc opened this issue Jan 26, 2025 · 2 comments
Closed

time: time.ParseInLocation can get the seconds wrong #71444

bbp-brieuc opened this issue Jan 26, 2025 · 2 comments
Labels
BugReport Issues describing a possible bug in the Go implementation.

Comments

@bbp-brieuc
Copy link

Go version

go version go1.23.4 darwin/arm64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/brieucjeunhomme/Library/Caches/go-build'
GOENV='/Users/brieucjeunhomme/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/brieucjeunhomme/go/pkg/mod'
GONOPROXY='github.com/bbp-brieuc'
GONOSUMDB='github.com/bbp-brieuc'
GOOS='darwin'
GOPATH='/Users/brieucjeunhomme/go'
GOPRIVATE='github.com/bbp-brieuc'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.23.4'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/brieucjeunhomme/Library/Application Support/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/brieucjeunhomme/eodhd/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/3t/k4p_jwdd147888b91dvqm6s80000gn/T/go-build325982754=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

I parsed a date with only a year and month:
fmt.Println(time.ParseInLocation("2006-05", "2025-01", time.UTC))

What did you see happen?

The resulting time had a non-0 second, the output was:
2025-01-01 00:00:01 +0000 UTC

What did you expect to see?

A result with a 0 second:
2025-01-01 00:00:00 +0000 UTC

@seankhliao
Copy link
Member

05 in the reference time corresponds to seconds.

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Jan 26, 2025
@gabyhelp gabyhelp added the BugReport Issues describing a possible bug in the Go implementation. label Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BugReport Issues describing a possible bug in the Go implementation.
Projects
None yet
Development

No branches or pull requests

3 participants