diff --git a/parseany.go b/parseany.go index 0407b79..b427d68 100644 --- a/parseany.go +++ b/parseany.go @@ -1345,7 +1345,12 @@ iterRunes: // 15:44:11 UTC+0100 2015 switch r { case '+', '-': - p.tzlen = i - p.tzi + if datestr[p.tzi:i] == "GMT" { + p.tzi = 0 + p.tzlen = 0 + } else { + p.tzlen = i - p.tzi + } if p.tzlen == 4 { p.set(p.tzi, " MST") } else if p.tzlen == 3 { @@ -1679,10 +1684,13 @@ iterRunes: p.trimExtra() case timeWsAlphaZoneOffset: // 06:20:00 UTC-05 - if i-p.offseti < 4 { + switch i - p.offseti { + case 2, 3, 4: p.set(p.offseti, "-07") - } else { + case 5: p.set(p.offseti, "-0700") + case 6: + p.set(p.offseti, "-07:00") } case timePeriod: diff --git a/parseany_test.go b/parseany_test.go index aeb201f..0193b52 100644 --- a/parseany_test.go +++ b/parseany_test.go @@ -419,6 +419,7 @@ var testInputs = []dateTest{ {in: "Wed, 8 Feb 2023 19:00:46 +1100 (AEDT)", out: "2023-02-08 08:00:46 +0000 UTC"}, {in: "FRI, 16 AUG 2013 9:39:51 +1000", out: "2013-08-15 23:39:51 +0000 UTC"}, + {in: "Mon, 1 Dec 2008 14:48:22 GMT-07:00", out: "2008-12-01 21:48:22 +0000 UTC"}, } func TestParse(t *testing.T) {