]> Cypherpunks repositories - gostls13.git/commitdiff
time: parse WITA timezone correctly
authorMax Riveiro <kavu13@gmail.com>
Sun, 11 Dec 2016 10:54:22 +0000 (13:54 +0300)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 12 Dec 2016 20:14:12 +0000 (20:14 +0000)
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/34253
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/time/format.go
src/time/format_test.go

index 3fbfa734d054dd0cad62e5317964af971a5a0d7a..b903e1485c69a67b84e0d6efdb64d286d33e119e 100644 (file)
@@ -1101,8 +1101,9 @@ func parseTimeZone(value string) (length int, ok bool) {
                if value[4] == 'T' {
                        return 5, true
                }
-       case 4: // Must end in T to match.
-               if value[3] == 'T' {
+       case 4:
+               // Must end in T, except one special case.
+               if value[3] == 'T' || value[:4] == "WITA" {
                        return 4, true
                }
        case 3:
index aa4434a09c3315fd011fc688a35d570e42dc1996..219c2caee8fd4dda440d828db2de1b94ca4edb77 100644 (file)
@@ -405,6 +405,7 @@ var parseTimeZoneTests = []ParseTimeZoneTest{
        {"ESAST hi", 5, true},
        {"ESASTT hi", 0, false}, // run of upper-case letters too long.
        {"ESATY hi", 0, false},  // five letters must end in T.
+       {"WITA hi", 4, true},    // Issue #18251
 }
 
 func TestParseTimeZone(t *testing.T) {