Another case.

This commit is contained in:
Arran Ubels 2023-02-16 09:39:34 +11:00
parent b0b5409675
commit 01b692d1ce
No known key found for this signature in database
GPG Key ID: 135EDC7B21D17F48
2 changed files with 12 additions and 3 deletions

View File

@ -1345,7 +1345,12 @@ iterRunes:
// 15:44:11 UTC+0100 2015
switch r {
case '+', '-':
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:

View File

@ -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) {