Handle more invalid dates

Fixes #617
This commit is contained in:
Frédéric Guillot 2020-04-25 20:03:39 -07:00
parent 7accdc4416
commit 619aa58fb3
2 changed files with 5 additions and 0 deletions

View file

@ -50,6 +50,7 @@ var dateFormats = []string{
"Monday, 02 January 2006 15:04:05",
"Monday, January 02, 2006 - 3:04pm",
"Monday, January 2, 2006 - 3:04pm",
"Mon, 01/02/2006 - 15:04",
"Mon, 2 January 2006 15:04 MST",
"Mon, 2 January 2006, 15:04 -0700",
"Mon, 2 January 2006, 15:04:05 MST",
@ -110,6 +111,7 @@ var dateFormats = []string{
"Mon, 02 Jan 2006",
"Mon, 02 Jan 06 15:04:05 MST",
"Mon, 02 Jan 2006 3:04 PM MST",
"January 02 2006 03:04:05 PM",
"January 2, 2006 3:04 PM",
"January 2, 2006, 3:04 p.m.",
"January 2, 2006 15:04:05 MST",

View file

@ -129,6 +129,9 @@ func TestParseWeirdDateFormat(t *testing.T) {
"Tue 16 Feb 2016, 23:16:00 EDT",
"Tue, 16 Feb 2016 23:16:00 EDT",
"Tue, Feb 16 2016 23:16:00 EDT",
"March 30 2020 07:02:38 PM",
"Mon, 30 Mar 2020 19:53 +0000",
"Mon, 03/30/2020 - 19:19",
}
for _, date := range dates {