Skip to content

time: AddDate(0, 0, 1) gives the same exact day in Samoa edge case #29602

@VictorDegliame

Description

@VictorDegliame

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone 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