SlyMarbo / rss

A Go library for fetching, parsing, and updating RSS feeds.
Other
400 stars 85 forks source link

accept unparsable dates #58

Closed ghost closed 7 years ago

ghost commented 7 years ago

Sadly, there are feeds out there that do not follow the standard. Often I encouter unparsable date or pubDate elements:

"Wed May 10 2017 00:00:00 GMT+0000 (Coordinated Universal Time)"
"Wed, 24 May 2017, 11:05"
"31.05.2017"

I've decided to not accept such dates that do not follow the RFCs but to drop them.

This PR changes the behaviour and does not not stop parsing of such a feed. Instead the default value of 0001-01-01 00:00:00 +0000 UTC is used.

SlyMarbo commented 7 years ago

I don't think we should print on encountering a bad date, as it's not something a package user can easily disable. Perhaps instead we have a DateValid field, which we set to true on success.

ghost commented 7 years ago

That's a good point, I will add this.

ghost commented 7 years ago

@SlyMarbo Please take look at the new DateValid field.

SlyMarbo commented 7 years ago

Great stuff