• Alberto Donizetti's avatar
    time: accept anything between -23 and 23 as offset namezone name · 2ce84112
    Alberto Donizetti authored
    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/120558Reviewed-by: 's avatarRob Pike <r@golang.org>
    2ce84112
format.go 38.9 KB