1
0
Fork 0

Add new formats to date parser

This commit is contained in:
Tony Wang 2019-10-21 00:52:18 +08:00 committed by Frédéric Guillot
parent bf357a0e2d
commit 5517eebafe
2 changed files with 6 additions and 0 deletions

View file

@ -28,6 +28,7 @@ var dateFormats = []string{
"Mon, January 02, 2006 15:04:05 MST",
"Mon, Jan 2, 2006 15:04 MST",
"Mon, Jan 2 2006 15:04 MST",
"Mon, Jan 2 2006 15:04:05 MST",
"Mon, Jan 2, 2006 15:04:05 MST",
"Mon, Jan 2 2006 15:04:05 -700",
"Mon, Jan 2 2006 15:04:05 -0700",
@ -101,6 +102,8 @@ var dateFormats = []string{
"Mon, 02 Jan 2006 15:04:05 -07:00",
"Mon, 02 Jan 2006 15:04:05 --0700",
"Mon 02 Jan 2006 15:04:05 -0700",
"Mon 02 Jan 2006, 15:04:05 MST",
"Mon, 02 Jan 2006 15:04:05 MST",
"Mon, 02 Jan 2006 15:04:05 -07",
"Mon, 02 Jan 2006 15:04:05 00",
"Mon, 02 Jan 2006 15:04:05",

View file

@ -126,6 +126,9 @@ func TestParseWeirdDateFormat(t *testing.T) {
"Do, 29 Mär 2018 00:00:00 +0200",
"mer, 9 avr 2018 00:00:00 +0200",
"1520932969",
"Tue 16 Feb 2016, 23:16:00 EDT",
"Tue, 16 Feb 2016 23:16:00 EDT",
"Tue, Feb 16 2016 23:16:00 EDT",
}
for _, date := range dates {