martinrotter / rssguard

Feed reader (and podcast player) which supports RSS/ATOM/JSON and many web-based feed services.
GNU General Public License v3.0
1.64k stars 125 forks source link

[BUG]: Some valid date/time strings are not recognized #1478

Closed itsCryne closed 3 months ago

itsCryne commented 3 months ago

Brief description of the issue

RSS Guard fails to recognize a date/time string if (e.g.) the day is only one digit or the timezone is UT although both are permitted by RFC822

How to reproduce the bug?

  1. Add feed: https://gist.github.com/itsCryne/65893359e21d5eaa85e140402abc53bf
  2. Fetch the feed

What was the expected result?

The pubDate of all three items should be shown.

What actually happened?

Only the pubDate of the first item is shown correctly. For the other items, the date/time of the fetch is shown. image

Debug log

https://gist.github.com/itsCryne/2564a2a65d624626bafa46ae36c79fc7 (l. 372 & 373 show the error)

Operating system and version

RSS Guard

Version: 4.7.3 (built on Linux/x86_64)
Revision: a4e20486b-lite
Build date: 7/26/24 4:34 AM
OS: Arch Linux
Qt: 6.7.2 (compiled against 6.7.2)
martinrotter commented 3 months ago

Perfect, will check these and add support for them

itsCryne commented 3 months ago

I don't have any experience with Qt and also only limited C++ knowledge but after having a look at the code it seems that we just need to add another line here in textfactory.cpp with

.replace(QSL("UT"), QSL("+0000"))

and add the following lines here

// Commented out patterns are already present

pat << QSL("d MMM yy HH:mm:ss");
pat << QSL("dd MMM yy HH:mm:ss");
pat << QSL("ddd, d MMM yy HH:mm:ss");
//  pat << QSL("ddd, dd MMM yy HH:mm:ss");
pat << QSL("d MMM yy HH:mm");
pat << QSL("dd MMM yy HH:mm");
pat << QSL("ddd, d MMM yy HH:mm");
pat << QSL("ddd, dd MMM yy HH:mm");

// Four digit year
// Not valid per RFC822
// but valid per RFC2822
pat << QSL("d MMM yyyy HH:mm:ss");
pat << QSL("dd MMM yyyy HH:mm:ss");
//  pat << QSL("ddd, d MMM yyyy HH:mm:ss");
//  pat << QSL("ddd, dd MMM yyyy HH:mm:ss");
pat << QSL("d MMM yyyy HH:mm");
pat << QSL("dd MMM yyyy HH:mm");
pat << QSL("ddd, d MMM yyyy HH:mm");
//  pat << QSL("ddd, dd MMM yyyy HH:mm");

If that seems correct, I could also submit a PR with those changes - but I guess it'd be faster/more convenient for you if you make them directly‽