]> Cypherpunks repositories - gostls13.git/commit
time: accept anything between -23 and 23 as offset namezone name
authorAlberto Donizetti <alb.donizetti@gmail.com>
Sun, 24 Jun 2018 11:42:59 +0000 (13:42 +0200)
committerAlberto Donizetti <alb.donizetti@gmail.com>
Tue, 21 Aug 2018 22:47:11 +0000 (22:47 +0000)
commit2ce8411239212b80a0d266dc123bb5b1ec84d211
tree2bf46f24eba08f052460e90562bb4d9a99ca5b63
parent1ae2eed0b22023cc06ad7f1a82d2df2b6877b14b
time: accept anything between -23 and 23 as offset namezone name

time.Parse currently rejects numeric timezones names with UTC offsets
bigger than +12, but this is incorrect: there's a +13 timezone and a
+14 timezone:

  $ zdump Pacific/Kiritimati
  Pacific/Kiritimati  Mon Jun 25 02:15:03 2018 +14

For convenience, this cl changes the ranges of accepted offsets from
-14..+12 to -23..+23 (zero still excluded), i.e. every possible offset
that makes sense. We don't validate three-letter abbreviations for the
timezones names, so there's no need to be too strict on numeric names.

This change also fixes a bug in the parseTimeZone, that is currently
unconditionally returning true (i.e. valid timezone), without checking
the value returned by parseSignedOffset.

This fixes 5 of 17 time.Parse() failures listed in Issue #26032.

Updates #26032

Change-Id: I2f08ca9aa41ea4c6149ed35ed2dd8f23eeb42bff
Reviewed-on: https://go-review.googlesource.com/120558
Reviewed-by: Rob Pike <r@golang.org>
src/time/format.go
src/time/format_test.go