]> Cypherpunks repositories - gostls13.git/commit
time: add to format documentation about dangers of using RFC1123{,Z} for parsing
authorDana Burkart <dana@zenful.ai>
Sat, 8 Jun 2024 03:30:30 +0000 (03:30 +0000)
committerGopher Robot <gobot@golang.org>
Tue, 11 Jun 2024 17:09:28 +0000 (17:09 +0000)
commitb3a57e43c7517491c6220b637f70918fa7ca6e20
treed0a58101dbf697897d0520b3d8c9de879a0bdd2e
parent3b6aa03c127ac9600ed17bd27ae94088b741846e
time: add to format documentation about dangers of using RFC1123{,Z} for parsing

When using time.RFC1123Z to parse the date header value out of an email,
an error is returned for dates that occur in the first 9 days of a
month. This is because the format strings for RFC 1123 defined in the
time package indicate that the day should be prefixed with a leading 0.

Reading the spec, the line that talks about it seems to indicate that
days can be either 1 or 2 digits:

  `date = 1*2DIGIT month 2*4DIGIT`

So a date header with a day like `7` with no leading zero should be
accepted.

Fixes #67887

Change-Id: Ie7ee40d94da2c8c0417957e8b89f9987314949c8
GitHub-Last-Rev: 22a5a52fcb7ee25e5005bb9a014ef8a94d52fb32
GitHub-Pull-Request: golang/go#67888
Reviewed-on: https://go-review.googlesource.com/c/go/+/591335
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/time/format.go