clarify published logic, add more date formats
Jes Olson j3s@c3f.net
Sat, 08 Jul 2023 01:43:07 -0500
2 files changed,
8 insertions(+),
2 deletions(-)
M
rss/atom.go
→
rss/atom.go
@@ -44,8 +44,11 @@
next := new(Item) next.Title = item.Title next.Summary = item.Summary - if item.Date == "" { - item.Date = item.Published + if item.Published != "" { + next.Date, err = parseTime(item.Published) + if err == nil { + next.DateValid = true + } } if item.Date != "" { next.Date, err = parseTime(item.Date)
M
rss/time.go
→
rss/time.go
@@ -71,6 +71,9 @@ "Jan 2, 06 15:04 PM -0700 MST",
// j3s additions "2006-01-02T15:04:05-0700", + "2006-01-02", + "02 Jan 2006 15:04:05 Z", + "Mon, 2 Jan 2006 15:04:05 -0700", } func parseTime(s string) (time.Time, error) {