Merge branch 'fix-time' of https://github.com/EdwinLove/parsemail into EdwinLove-fix-time
diff --git a/parsemail.go b/parsemail.go
index 1cde6c8..3011f96 100644
--- a/parsemail.go
+++ b/parsemail.go
@@ -390,12 +390,19 @@
return
}
- t, hp.err = time.Parse(time.RFC1123Z, s)
- if hp.err == nil {
- return t
+ formats := []string{
+ time.RFC1123Z,
+ "Mon, 2 Jan 2006 15:04:05 -0700",
+ time.RFC1123Z + " (MST)",
+ "Mon, 2 Jan 2006 15:04:05 -0700 (MST)",
}
- t, hp.err = time.Parse("Mon, 2 Jan 2006 15:04:05 -0700", s)
+ for _, format := range formats {
+ t, hp.err = time.Parse(format, s)
+ if hp.err == nil {
+ return
+ }
+ }
return
}