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: invalid Weekday for old dates #23462

Closed
kovetskiy opened this Issue Jan 17, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@kovetskiy
Copy link

kovetskiy commented Jan 17, 2018

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

Go 1.9.2 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/user/go"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build368226252=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

https://play.golang.org/p/Iv3m-4cuqUr

What did you expect to see?

I expect to see that the 3rd Januray of 1010 year is Tuesday.
http://henry.pha.jhu.edu/calendarDir/julianDir/julianHTML/1010.html

output from cal program is also showing Tuesday:

                               1010

       January               February                 March
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
 1  2  3  4  5  6  7             1  2  3  4             1  2  3  4

What did you see instead?

I see Wednesday.

@kovetskiy

This comment has been minimized.

Copy link
Author

kovetskiy commented Jan 17, 2018

google: day of week 3rd january of 1010
result: Wednesday, December 28, 1009

@dominikh

This comment has been minimized.

Copy link
Member

dominikh commented Jan 17, 2018

The time package uses the Gregorian calendar, not the Julian calendar. January 3rd, 1010 in the Gregorian calendar translates to (via extrapolation) December 28th, 1009 in the Julian calendar[1][2], which was indeed a Wednesday. That's also what your Google search is telling you.

Since the time package clearly states that it uses (only) the Gregorian calendar I don't think that there's anything to do here.

[1] https://en.wikipedia.org/wiki/Conversion_between_Julian_and_Gregorian_calendars
[2] https://www.wolframalpha.com/input/?i=January+3rd+1010+in+Gregorian+calendar

@dominikh dominikh closed this Jan 17, 2018

@dominikh dominikh changed the title invalid Weekday for old dates time: invalid Weekday for old dates Jan 17, 2018

@golang golang locked and limited conversation to collaborators Jan 17, 2019

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