danmactough / node-feedparser

Robust RSS, Atom, and RDF feed parsing in Node.js
Other
1.97k stars 190 forks source link

Return date string if it is not in valid JS date format #256

Closed Praveena0989 closed 6 years ago

Praveena0989 commented 6 years ago

feedparser is returning Invalid date for date string if it is not a valid JS date format but instead of that you can just return the string itself so that there will be room for us to change the date string to right format with site specific rule and convert it back to JS Date.

Example Feed rss

danmactough commented 6 years ago

@Praveena0989 Yeah, that is really annoying. Feed producers created some terrible, bad stuff. Luckily, in addition to the normalized items like date (the "happy path"), the original parsed elements are also available. Since this is an rss feed, each item also has the rss:pubdate property:

{
 "rss:pubdate": {
    "@": {},
    "#": "Sunday,August 6,2017 13:14 pm"
  }
}

So, you can fallback to item['rss:pubdate']['#'].

Praveena0989 commented 6 years ago

Cool. Thank you @danmactough