From: Ian Lance Taylor Date: Mon, 28 Mar 2022 17:18:03 +0000 (-0700) Subject: net/mail: accept UT as a timezone X-Git-Tag: go1.19beta1~894 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=3c7f9b80222376fa01f8c6e3b411281c23dd74ed;p=gostls13.git net/mail: accept UT as a timezone Fixes #39906 Change-Id: I8fcaf4c1ccc4131d770cff08d9c80f520885a6b5 Reviewed-on: https://go-review.googlesource.com/c/go/+/396214 Trust: Ian Lance Taylor Run-TryBot: Ian Lance Taylor TryBot-Result: Gopher Robot Reviewed-by: Emmanuel Odeke --- diff --git a/src/net/mail/message.go b/src/net/mail/message.go index 5770e3d8dc..61a3a26b01 100644 --- a/src/net/mail/message.go +++ b/src/net/mail/message.go @@ -79,7 +79,7 @@ func buildDateLayouts() { years := [...]string{"2006", "06"} // year = 4*DIGIT / 2*DIGIT seconds := [...]string{":05", ""} // second // "-0700 (MST)" is not in RFC 5322, but is common. - zones := [...]string{"-0700", "MST"} // zone = (("+" / "-") 4DIGIT) / "GMT" / ... + zones := [...]string{"-0700", "MST", "UT"} // zone = (("+" / "-") 4DIGIT) / "UT" / "GMT" / ... for _, dow := range dows { for _, day := range days { diff --git a/src/net/mail/message_test.go b/src/net/mail/message_test.go index 41c54b8687..61e50ccfd5 100644 --- a/src/net/mail/message_test.go +++ b/src/net/mail/message_test.go @@ -265,11 +265,21 @@ func TestDateParsingCFWS(t *testing.T) { { "Tue, 26 May 2020 14:04:40 UT", time.Date(2020, 05, 26, 14, 04, 40, 0, time.UTC), - false, + true, }, { "Thu, 21 May 2020 14:04:40 UT", time.Date(2020, 05, 21, 14, 04, 40, 0, time.UTC), + true, + }, + { + "Tue, 26 May 2020 14:04:40 XT", + time.Date(2020, 05, 26, 14, 04, 40, 0, time.UTC), + false, + }, + { + "Thu, 21 May 2020 14:04:40 XT", + time.Date(2020, 05, 21, 14, 04, 40, 0, time.UTC), false, }, {