-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
Go version
go 1.23.4 Darwin/macOs Sequoia 15.2, Mac mini with M$ processor
Output of go env in your module/workspace:
Last login: Thu Jan 23 19:45:31 on console
jankampherbeek@Mac-mini-van-Jan ~ % go env
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/jankampherbeek/Library/Caches/go-build'
GOENV='/Users/jankampherbeek/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/jankampherbeek/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/jankampherbeek/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.23.4/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.23.4/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.23.4'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/jankampherbeek/Library/Application Support/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/dev/null'
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/ww/nt70fd0d3sz8d85b2t874x8h0000gn/T/go-build1452302060=/tmp/go-build -gno-record-gcc-switches -fno-common'
jankampherbeek@Mac-mini-van-Jan ~ %What did you do?
The tzdata library is supposed to cover all data in the IANA tz Database.
However it appears that a part of the data is missing, for instance the data for the Netherlands before 1941.
I tested this with the following code:
package main
import (
"fmt"
"runtime"
"time"
_ "time/tzdata"
)
func main() {
fmt.Printf("Go version: %s\n", runtime.Version())
loc, err := time.LoadLocation("Europe/Amsterdam")
if err != nil {
panic(err)
}
dates := []time.Time{
time.Date(1892, 1, 1, 12, 0, 0, 0, time.UTC),
time.Date(1900, 1, 1, 12, 0, 0, 0, time.UTC),
time.Date(1909, 1, 1, 12, 0, 0, 0, time.UTC),
time.Date(1937, 1, 1, 12, 0, 0, 0, time.UTC),
time.Date(1940, 5, 15, 12, 0, 0, 0, time.UTC),
time.Date(1940, 5, 16, 12, 0, 0, 0, time.UTC),
time.Date(1941, 5, 17, 12, 0, 0, 0, time.UTC),
}
for _, date := range dates {
local := date.In(loc)
name, offset := local.Zone()
fmt.Printf("%v: %s (offset: %d seconds)\n",
date.Format("2006-01-02"),
name,
offset)
}
}
What did you see happen?
This code results in the following output:
Go version: go1.23.4
1892-01-01: BMT (offset: 1050 seconds)
1900-01-01: WET (offset: 0 seconds)
1909-01-01: WET (offset: 0 seconds)
1937-01-01: WET (offset: 0 seconds)
1940-05-15: WEST (offset: 3600 seconds)
1940-05-16: WEST (offset: 3600 seconds)
1941-05-17: CEST (offset: 7200 seconds)
What did you expect to see?
The data for the Netherlands for this period are in the tz database file 'backzone':
Rule Neth 1916 only - May 1 0:00 1:00 NST # Netherlands Summer Time
Rule Neth 1916 only - Oct 1 0:00 0 AMT # Amsterdam Mean Time
Rule Neth 1917 only - Apr 16 2:00s 1:00 NST
Rule Neth 1917 only - Sep 17 2:00s 0 AMT
Rule Neth 1918 1921 - Apr Mon>=1 2:00s 1:00 NST
Rule Neth 1918 1921 - Sep lastMon 2:00s 0 AMT
Rule Neth 1922 only - Mar lastSun 2:00s 1:00 NST
Rule Neth 1922 1936 - Oct Sun>=2 2:00s 0 AMT
Rule Neth 1923 only - Jun Fri>=1 2:00s 1:00 NST
Rule Neth 1924 only - Mar lastSun 2:00s 1:00 NST
Rule Neth 1925 only - Jun Fri>=1 2:00s 1:00 NST
# From 1926 through 1939 DST began 05-15, except that it was delayed by a week
# in years when 05-15 fell in the Pentecost weekend.
Rule Neth 1926 1931 - May 15 2:00s 1:00 NST
Rule Neth 1932 only - May 22 2:00s 1:00 NST
Rule Neth 1933 1936 - May 15 2:00s 1:00 NST
Rule Neth 1937 only - May 22 2:00s 1:00 NST
Rule Neth 1937 only - Jul 1 0:00 1:00 S
Rule Neth 1937 1939 - Oct Sun>=2 2:00s 0 -
Rule Neth 1938 1939 - May 15 2:00s 1:00 S
Rule Neth 1945 only - Apr 2 2:00s 1:00 S
Rule Neth 1945 only - Sep 16 2:00s 0 -
#STDOFF 0:19:32.13
Zone Europe/Amsterdam 0:19:32 - LMT 1835
0:19:32 Neth %s 1937 Jul 1
0:20 Neth +0020/+0120 1940 May 16 0:00
1:00 C-Eur CE%sT 1945 Apr 2 2:00
1:00 Neth CE%sT 1977
1:00 EU CE%sT
The correct value for the offset should have been 19 minutes and 32 seconds (1172 seconds). Is it possible to add the missing data to the tzdata library?