Closed joeyh closed 11 years ago
There's not overwhelming adherence to what the specs say on date formatting, though. Feel free to come up with reliable parsing of dates in Haskell for feeds & submit a pull request.
(I've had to spend months to get date handling reliable and right for a commercial service that's currently processing 10k feeds or so from around the globe. Not done in Haskell. People do the strangest things when it comes to dates.)
sof wrote:
There's not overwhelming adherence to what the specs say on date formatting, though. Feel free to come up with reliable parsing of dates in Haskell for feeds & submit a pull request.
Would a Maybe Date be acceptable that works on dates that do conform to the standards?
see shy jo
I don't like that too much, you're left with nothing if it fails.
sof wrote:
I don't like that too much, you're left with nothing if it fails.
Either String Date then?
see shy jo
That would be great since an API user will want to parse it anyway. Currently I use "%a, %e %b %Y %H:%M:%S %Z" to parse pubdate, but not sure it will work everywhere.
I don't mind putting in a rfc822-like parser like that, but it won't be sufficient in general. (And I really don't want to take on providing reliable parsing of feed dates.)
So, how about:
getItemPublishDate :: ItemGetter (Maybe Date) getItemPublishDateString :: ItemGetter DateString
with the former returning Nothing if there isn't a pub date, but (Just Nothing) if it was unparseable. And documented as only supporting RFC822.
Seems to me this at least also needs to support RFC3339 dates as used in Atom.
Slippery slope.. pull request?
getItemPublishDate currently returns a String, which can be formatted in a few different ways depending on the type of feed. It would be really great if this was changed to returning a parsed date. Use cases include sorting a set of feeds' items by date for display, and in my case, including the date in a filename when downloading a podcast.