Go version
go version go1.22.1 darwin/arm64
Output of go env in your module/workspace:
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/dburkart/Library/Caches/go-build'
GOENV='/Users/dburkart/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/dburkart/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/dburkart/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.1'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
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/1m/2p4knn216k755wpkh1vlz4_00000gn/T/go-build1317344447=/tmp/go-build -gno-record-gcc-switches -fno-common'
What did you do?
We have been using time.RFC1123Z to parse the Date header of emails.
We found that sometimes this would work, and sometimes it would not. I tracked this down to "the time of the month". Specifically, if you try to parse an email date from days 1 - 9 of the month, time.Parse() with time.RFC1123Z throws an error, but on days 10 - 3x, it parses just fine.
Specifically, it seems that this part of RFC 1123 indicates that the day can only be 2 digits if the first is a '1' one or two digits:
date = 1*2DIGIT month 2*4DIGIT
This means that a Date string (that I pulled from one of my emails) like this doesn't parse:
Fri, 7 Jun 2024 13:04:42 -0400
But this will:
Fri, 31 May 2024 09:57:48 +0000
What did you see happen?
Most of the time this works, but sometimes it does not.
What did you expect to see?
It should always work, since RFC 1123 defines the date / time expected in an email header.
Go version
go version go1.22.1 darwin/arm64
Output of
go envin your module/workspace:What did you do?
We have been using
time.RFC1123Zto parse theDateheader of emails.We found that sometimes this would work, and sometimes it would not. I tracked this down to "the time of the month". Specifically, if you try to parse an email date from days 1 - 9 of the month,
time.Parse()withtime.RFC1123Zthrows an error, but on days 10 - 3x, it parses just fine.Specifically, it seems that this part of RFC 1123 indicates that the day can
only be 2 digits if the first is a '1'one or two digits:date = 1*2DIGIT month 2*4DIGITThis means that a Date string (that I pulled from one of my emails) like this doesn't parse:
Fri, 7 Jun 2024 13:04:42 -0400But this will:
Fri, 31 May 2024 09:57:48 +0000What did you see happen?
Most of the time this works, but sometimes it does not.
What did you expect to see?
It should always work, since RFC 1123 defines the date / time expected in an email header.