mirror of
https://github.com/araddon/dateparse.git
synced 2025-04-19 23:30:31 +08:00
issue-130 fix timezone detection issue after timePeriod
This commit is contained in:
parent
6b43995a97
commit
068594790e
@ -1503,6 +1503,8 @@ iterRunes:
|
|||||||
// 22:18:00.001 +0000 UTC m=+0.000000001
|
// 22:18:00.001 +0000 UTC m=+0.000000001
|
||||||
// timePeriodWsAlpha
|
// timePeriodWsAlpha
|
||||||
// 06:20:00.000 UTC
|
// 06:20:00.000 UTC
|
||||||
|
// timeZ
|
||||||
|
// 15:09:23.099Z
|
||||||
switch r {
|
switch r {
|
||||||
case ' ':
|
case ' ':
|
||||||
p.mslen = i - p.msi
|
p.mslen = i - p.msi
|
||||||
@ -1512,6 +1514,11 @@ iterRunes:
|
|||||||
p.mslen = i - p.msi
|
p.mslen = i - p.msi
|
||||||
p.offseti = i
|
p.offseti = i
|
||||||
p.stateTime = timePeriodOffset
|
p.stateTime = timePeriodOffset
|
||||||
|
case 'Z':
|
||||||
|
p.mslen = i - p.msi
|
||||||
|
// (Z)ulu time
|
||||||
|
p.loc = time.UTC
|
||||||
|
p.stateTime = timeZ
|
||||||
default:
|
default:
|
||||||
if unicode.IsLetter(r) {
|
if unicode.IsLetter(r) {
|
||||||
// 06:20:00.000 UTC
|
// 06:20:00.000 UTC
|
||||||
|
@ -389,6 +389,7 @@ var testInputs = []dateTest{
|
|||||||
{in: "2009-08-12T22:15Z", out: "2009-08-12 22:15:00 +0000 UTC"},
|
{in: "2009-08-12T22:15Z", out: "2009-08-12 22:15:00 +0000 UTC"},
|
||||||
{in: "2009-08-12T22:15:09Z", out: "2009-08-12 22:15:09 +0000 UTC"},
|
{in: "2009-08-12T22:15:09Z", out: "2009-08-12 22:15:09 +0000 UTC"},
|
||||||
{in: "2009-08-12T22:15:09.99Z", out: "2009-08-12 22:15:09.99 +0000 UTC"},
|
{in: "2009-08-12T22:15:09.99Z", out: "2009-08-12 22:15:09.99 +0000 UTC"},
|
||||||
|
{in: "2009-08-12T22:15:09.99Z", out: "2009-08-12 22:15:09.99 +0000 UTC", loc: "Asia/Shanghai"},
|
||||||
{in: "2009-08-12T22:15:09.9999Z", out: "2009-08-12 22:15:09.9999 +0000 UTC"},
|
{in: "2009-08-12T22:15:09.9999Z", out: "2009-08-12 22:15:09.9999 +0000 UTC"},
|
||||||
{in: "2009-08-12T22:15:09.99999999Z", out: "2009-08-12 22:15:09.99999999 +0000 UTC"},
|
{in: "2009-08-12T22:15:09.99999999Z", out: "2009-08-12 22:15:09.99999999 +0000 UTC"},
|
||||||
{in: "2009-08-12T22:15:9.99999999Z", out: "2009-08-12 22:15:09.99999999 +0000 UTC"},
|
{in: "2009-08-12T22:15:9.99999999Z", out: "2009-08-12 22:15:09.99999999 +0000 UTC"},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user