mirror of
https://github.com/araddon/dateparse.git
synced 2024-11-10 11:51:54 +08:00
Additional missed format for refs #74 date format with rd
This commit is contained in:
parent
313f117957
commit
21df004e09
15
parseany.go
15
parseany.go
@ -786,15 +786,12 @@ iterRunes:
|
|||||||
return parseTime(fmt.Sprintf("%s%s", p.datestr[0:i], p.datestr[i+2:]), loc)
|
return parseTime(fmt.Sprintf("%s%s", p.datestr[0:i], p.datestr[i+2:]), loc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// case ',':
|
case 'r', 'R':
|
||||||
// // x
|
if p.nextIs(i, 'd') || p.nextIs(i, 'D') {
|
||||||
// // April 8th, 2009
|
if len(datestr) > i+2 {
|
||||||
// case ' ':
|
return parseTime(fmt.Sprintf("%s%s", p.datestr[0:i], p.datestr[i+2:]), loc)
|
||||||
// // x
|
}
|
||||||
// // April 8th 2009
|
}
|
||||||
// // p.yeari = i + 1
|
|
||||||
// p.yeari = i + 1
|
|
||||||
// p.stateDate = dateAlphaWsMonthMore
|
|
||||||
}
|
}
|
||||||
case dateAlphaWsMore:
|
case dateAlphaWsMore:
|
||||||
// January 02, 2006, 15:04:05
|
// January 02, 2006, 15:04:05
|
||||||
|
@ -88,7 +88,7 @@ var testInputs = []dateTest{
|
|||||||
{in: "May 7, 2012", out: "2012-05-07 00:00:00 +0000 UTC"},
|
{in: "May 7, 2012", out: "2012-05-07 00:00:00 +0000 UTC"},
|
||||||
{in: "June 7, 2012", out: "2012-06-07 00:00:00 +0000 UTC"},
|
{in: "June 7, 2012", out: "2012-06-07 00:00:00 +0000 UTC"},
|
||||||
{in: "June 7 2012", out: "2012-06-07 00:00:00 +0000 UTC"},
|
{in: "June 7 2012", out: "2012-06-07 00:00:00 +0000 UTC"},
|
||||||
// Month dd[th,nd,st] yyyy
|
// Month dd[th,nd,st,rd] yyyy
|
||||||
{in: "September 17th, 2012", out: "2012-09-17 00:00:00 +0000 UTC"},
|
{in: "September 17th, 2012", out: "2012-09-17 00:00:00 +0000 UTC"},
|
||||||
{in: "September 17th 2012", out: "2012-09-17 00:00:00 +0000 UTC"},
|
{in: "September 17th 2012", out: "2012-09-17 00:00:00 +0000 UTC"},
|
||||||
{in: "September 7th, 2012", out: "2012-09-07 00:00:00 +0000 UTC"},
|
{in: "September 7th, 2012", out: "2012-09-07 00:00:00 +0000 UTC"},
|
||||||
@ -97,6 +97,8 @@ var testInputs = []dateTest{
|
|||||||
{in: "May 1st, 2012", out: "2012-05-01 00:00:00 +0000 UTC"},
|
{in: "May 1st, 2012", out: "2012-05-01 00:00:00 +0000 UTC"},
|
||||||
{in: "May 21st 2012", out: "2012-05-21 00:00:00 +0000 UTC"},
|
{in: "May 21st 2012", out: "2012-05-21 00:00:00 +0000 UTC"},
|
||||||
{in: "May 21st, 2012", out: "2012-05-21 00:00:00 +0000 UTC"},
|
{in: "May 21st, 2012", out: "2012-05-21 00:00:00 +0000 UTC"},
|
||||||
|
{in: "May 23rd 2012", out: "2012-05-23 00:00:00 +0000 UTC"},
|
||||||
|
{in: "May 23rd, 2012", out: "2012-05-23 00:00:00 +0000 UTC"},
|
||||||
{in: "June 2nd, 2012", out: "2012-06-02 00:00:00 +0000 UTC"},
|
{in: "June 2nd, 2012", out: "2012-06-02 00:00:00 +0000 UTC"},
|
||||||
{in: "June 2nd 2012", out: "2012-06-02 00:00:00 +0000 UTC"},
|
{in: "June 2nd 2012", out: "2012-06-02 00:00:00 +0000 UTC"},
|
||||||
{in: "June 22nd, 2012", out: "2012-06-22 00:00:00 +0000 UTC"},
|
{in: "June 22nd, 2012", out: "2012-06-22 00:00:00 +0000 UTC"},
|
||||||
|
Loading…
Reference in New Issue
Block a user