diff options
| author | Agniva De Sarker <agnivade@yahoo.co.in> | 2018-11-08 09:48:06 +0530 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2018-11-08 17:33:49 +0000 |
| commit | 5e9ad4a9b4a11e1e879ff061e09a10eef6bd605b (patch) | |
| tree | acce6c3425433696896374d1459adf0e4622500b /src | |
| parent | 13baf4b2cd34dfb41c570e35b48ec287713f4d7f (diff) | |
| download | go-5e9ad4a9b4a11e1e879ff061e09a10eef6bd605b.tar.xz | |
time: handle negative offsets on js/wasm
Fixes #28649
Change-Id: I9f6807ee3c3007f670dd509780805c7b255a2bda
Reviewed-on: https://go-review.googlesource.com/c/148338
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/time/zoneinfo_js.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/time/zoneinfo_js.go b/src/time/zoneinfo_js.go index d640c831bf..2d76a571f2 100644 --- a/src/time/zoneinfo_js.go +++ b/src/time/zoneinfo_js.go @@ -33,6 +33,7 @@ func initLocal() { z.name = "UTC" if offset < 0 { z.name += "-" + offset *= -1 } else { z.name += "+" } @@ -44,8 +45,8 @@ func initLocal() { localLoc.zone = []zone{z} } -// itoa is just the fast path implementation copied from strconv.Itoa. -// No timezone hour can exceed 100, so the fast path will always satisfy. +// itoa is like strconv.Itoa but only works for values of i in range [0,99]. +// It panics if i is out of range. func itoa(i int) string { if i < 10 { return digits[i : i+1] |
