Skip to content

time: Incorrect zonebounds on location based on POSIX TZ string #70633

@Achilleshiel

Description

@Achilleshiel

Go version

go version go1.23.3 linux/amd64

Output of go env in your module/workspace:

GO111MODULE='on'
GOARCH='amd64'
GOBIN='/home/wouter/go/bin/'
GOCACHE='/home/wouter/.cache/go-build'
GOENV='/home/wouter/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/wouter/go/pkg/mod'
GONOPROXY='gitlab.figonet.nl'
GONOSUMDB='gitlab.figonet.nl'
GOOS='linux'
GOPATH='/home/wouter/go'
GOPRIVATE='gitlab.figonet.nl'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/lib64/golang'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/lib64/golang/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.3'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/wouter/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='x86_64-solus-linux-gcc'
CXX='x86_64-solus-linux-g++'
CGO_ENABLED='1'
GOMOD='/home/wouter/Development/modules/sw_bca/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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2766243939=/tmp/go-build -gno-record-gcc-switches'

What did you do?

My goal was to check if a posix tz string has the same time zone transitions as a given time.Location.
Via an empty Time zone information format string I loaded a Posix timezone string as location:
https://go.dev/play/p/iRKJ1idPNz6.
Using the loaded location I call ZoneBounds().

What did you see happen?

As from the go.dev/play example: it returns the end of DST and the end of the year.

What did you expect to see?

I expected to see get the end of DST and the start of the DST in the next year.

Debugging

I dug through the time library and found this comment:

	// The start and end values that we return are accurate
	// close to a daylight savings transition, but are otherwise
	// just the start and end of the year. That suffices for
	// the only caller that cares, which is Date.

This comment predates the addition of the ZoneBounds method. Which is now a second caller that cares.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions