Commit bc61026c authored by Max Riveiro's avatar Max Riveiro Committed by Brad Fitzpatrick

time: parse WITA timezone correctly

WITA stands for Asia/Makassar IANA timezone
https://en.wikipedia.org/wiki/Asia/Makassar

Fixes #18251

Change-Id: I5896efb8052593afb4e51ae4a34b574a8206d4dc
Reviewed-on: https://go-review.googlesource.com/34253Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent fded5dbb
...@@ -1101,8 +1101,9 @@ func parseTimeZone(value string) (length int, ok bool) { ...@@ -1101,8 +1101,9 @@ func parseTimeZone(value string) (length int, ok bool) {
if value[4] == 'T' { if value[4] == 'T' {
return 5, true return 5, true
} }
case 4: // Must end in T to match. case 4:
if value[3] == 'T' { // Must end in T, except one special case.
if value[3] == 'T' || value[:4] == "WITA" {
return 4, true return 4, true
} }
case 3: case 3:
......
...@@ -405,6 +405,7 @@ var parseTimeZoneTests = []ParseTimeZoneTest{ ...@@ -405,6 +405,7 @@ var parseTimeZoneTests = []ParseTimeZoneTest{
{"ESAST hi", 5, true}, {"ESAST hi", 5, true},
{"ESASTT hi", 0, false}, // run of upper-case letters too long. {"ESASTT hi", 0, false}, // run of upper-case letters too long.
{"ESATY hi", 0, false}, // five letters must end in T. {"ESATY hi", 0, false}, // five letters must end in T.
{"WITA hi", 4, true}, // Issue #18251
} }
func TestParseTimeZone(t *testing.T) { func TestParseTimeZone(t *testing.T) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment