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: AddDate(0, 0, 1) gives the same exact day in Samoa edge case #29602

Open
VictorDegliame opened this Issue Jan 7, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@VictorDegliame
Copy link

VictorDegliame commented Jan 7, 2019

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

$ go version
go version go1.11.2 darwin/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=""
GOCACHE="/Users/me/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/me/gocode"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11.2/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11.2/libexec/pkg/tool/darwin_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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/tj/b6jfdlvn48n0k1jzb4vbdzmm0000gn/T/go-build284351641=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I was testing that my code was properly adding a day to a weird Samoa edge case where they skipped a day at the end of 2011 (2011-12-29 + 1 day is 2011-12-31).
https://play.golang.org/p/RomvXuHl3Pi

What did you expect to see?

Adding a day to 2011-12-29 in Samoa should give 2011-12-31 after normalization.

What did you see instead?

Adding a day to 2011-12-29 in Samoa normalizes down and thus gives exactly the same date and hour

Additional information

If we set the hour to 10am or above on 2011-12-29 in Samoa, this works fine.
https://play.golang.org/p/eOX7s2P10-u

@agnivade agnivade changed the title time.AddDate(0, 0, 1) gives the same exact day in Samoa edge case time: AddDate(0, 0, 1) gives the same exact day in Samoa edge case Jan 8, 2019

@agnivade agnivade added this to the Go1.13 milestone Jan 8, 2019

@agnivade

This comment has been minimized.

Copy link
Member

agnivade commented Jan 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment