Improve date parser to handle various broken date formats
This commit is contained in:
parent
30d4b8986a
commit
b13c7e328a
2 changed files with 14 additions and 0 deletions
|
@ -211,6 +211,14 @@ var dateFormats = []string{
|
|||
"Jan. 2, 2006, 03:04 p.m.",
|
||||
"2006-01-02 15:04:05 -07:00",
|
||||
"2 January, 2006",
|
||||
"2 Jan 2006 MST",
|
||||
"Mon, January 2, 2006 at 03:04 PM MST",
|
||||
"Jan 2, 2006 15:04 MST",
|
||||
"01/02/2006 3:04 pm MST",
|
||||
"Mon, 2th Jan 2006 15:04:05 MST",
|
||||
"Mon, 2rd Jan 2006 15:04:05 MST",
|
||||
"Mon, 2nd Jan 2006 15:04:05 MST",
|
||||
"Mon, 2st Jan 2006 15:04:05 MST",
|
||||
}
|
||||
|
||||
var invalidTimezoneReplacer = strings.NewReplacer(
|
||||
|
|
|
@ -179,6 +179,12 @@ func TestParseWeirdDateFormat(t *testing.T) {
|
|||
"mar., 01 déc. 2020 16:11:02 +0000",
|
||||
"Thurs, 15 Oct 2020 00:00:39 +0000",
|
||||
"Thur, 19 Nov 2020 00:00:39 +0000",
|
||||
"26 Sep 2022 GMT",
|
||||
"Thu, June 22, 2023 at 01:11 PM EDT",
|
||||
"Apr 16, 2023 08:01 GMT",
|
||||
"Jun 23, 2023 19:00 GMT",
|
||||
"09/15/2014 4:20 pm PST",
|
||||
"Fri, 23rd Jun 2023 09:32:20 GMT",
|
||||
}
|
||||
|
||||
for _, date := range dates {
|
||||
|
|
Loading…
Reference in a new issue