mirror of
https://github.com/araddon/dateparse.git
synced 2024-11-10 11:51:54 +08:00
Another case.
This commit is contained in:
parent
b0b5409675
commit
01b692d1ce
12
parseany.go
12
parseany.go
@ -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:
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user