mirror of
https://github.com/araddon/dateparse.git
synced 2024-11-14 11:31:33 +08:00
Fix ambiguous mm/dd that start with weekday
Options were not being properly passed to recursive parseTime call.
This commit is contained in:
parent
4f7e8545ec
commit
4d76f597be
@ -1259,7 +1259,7 @@ iterRunes:
|
|||||||
// using skip throws off indices used by other code; saner to restart
|
// using skip throws off indices used by other code; saner to restart
|
||||||
newDateStr := p.datestr[i+1:]
|
newDateStr := p.datestr[i+1:]
|
||||||
putBackParser(p)
|
putBackParser(p)
|
||||||
return parseTime(newDateStr, loc)
|
return parseTime(newDateStr, loc, opts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// X
|
// X
|
||||||
|
@ -701,6 +701,9 @@ var testInputs = []dateTest{
|
|||||||
{in: "19/03/2012 10:11:59", out: "2012-03-19 10:11:59 +0000 UTC", preferDayFirst: true},
|
{in: "19/03/2012 10:11:59", out: "2012-03-19 10:11:59 +0000 UTC", preferDayFirst: true},
|
||||||
{in: "19/03/2012 10:11:59.3186369", out: "2012-03-19 10:11:59.3186369 +0000 UTC", retryAmbiguous: true},
|
{in: "19/03/2012 10:11:59.3186369", out: "2012-03-19 10:11:59.3186369 +0000 UTC", retryAmbiguous: true},
|
||||||
{in: "19/03/2012 10:11:59.3186369", out: "2012-03-19 10:11:59.3186369 +0000 UTC", preferDayFirst: true},
|
{in: "19/03/2012 10:11:59.3186369", out: "2012-03-19 10:11:59.3186369 +0000 UTC", preferDayFirst: true},
|
||||||
|
// For certain parse modes that restart parsing, make sure that parsing options are passed along!
|
||||||
|
{in: "Monday 19/03/2012 10:11:59", out: "2012-03-19 10:11:59 +0000 UTC", retryAmbiguous: true},
|
||||||
|
{in: "Monday 19/03/2012 10:11:59", out: "2012-03-19 10:11:59 +0000 UTC", preferDayFirst: true},
|
||||||
// https://github.com/araddon/dateparse/issues/105
|
// https://github.com/araddon/dateparse/issues/105
|
||||||
{in: "20/5/2006 19:51:45", out: "2006-05-20 19:51:45 +0000 UTC", retryAmbiguous: true},
|
{in: "20/5/2006 19:51:45", out: "2006-05-20 19:51:45 +0000 UTC", retryAmbiguous: true},
|
||||||
{in: "20/5/2006 19:51:45", out: "2006-05-20 19:51:45 +0000 UTC", preferDayFirst: true},
|
{in: "20/5/2006 19:51:45", out: "2006-05-20 19:51:45 +0000 UTC", preferDayFirst: true},
|
||||||
|
Loading…
Reference in New Issue
Block a user