Better support for malformed dates in RSS feeds

  • 2
  • Problem
  • Updated 6 years ago
My comment feed (http://www.highprogrammer.com/cgi-bin... ) was emitting malformed dates, notably in the pubDate. It was missing the leading zeros on the day of the month and the hour of the day. So it would say "Sun, 9 Jun 2013 9:35:55 CDT" when it should say "Sun, 09 Jun 2013 09:35:55 CDT". I think this is why Newsblur would occasionally list unexpected times on items, including sorting them based on the unexpected time. For example, the Newsblur thinks GUID http://www.highprogrammer.com/cgi-bin... was posted 11 June 2013, 8:00 pm, but it was actualy posted 12 Jun 2013, 9:03 am; even accounting for time zones that seems incorrect.

I've corrected the bug in my RSS generator, and I'm hoping to have no problems going forward. But it seems a mistake others might make and hopefully one Newsblur could easily workaround.
Photo of Alan

Alan

  • 25 Posts
  • 1 Reply Like

Posted 6 years ago

  • 2
Photo of Samuel Clay

Samuel Clay, Official Rep

  • 6514 Posts
  • 1474 Reply Likes
Wow, thanks for that write-up. Here's what I do today:

https://github.com/samuelclay/NewsBlu...

I'm using a third-party library called dateutil, which looks like this:

http://labix.org/python-dateutil#head...

And that library does a heck of a job better than I would of parsing dates, so it's the best I've got.
Photo of Kazriko Redclaw

Kazriko Redclaw

  • 51 Posts
  • 6 Reply Likes
Looking forward to this, hopefully it fixes my issues as well!