-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parsing dates in different locales #638
Comments
That's really weird. I think we don't have a solution for that 🤔 |
@FrancescoMarzullo01, are you sure a non-English date is RFC-compliant? RFC 822 seems to suggest only English tokens are supported. Going by that, I'd venture to say your dates are not RFC-compliant I am afraid. |
A non-English date is not RFC-compliant, but Rome provides a date parser that parses all dates based on the locale of SyndFeedInput or WireFeedInput. It would be optimal to use this possibility locally where necessary. One solution could be to specify additional locales within the Rome properties as "datatime.extra.locales"
|
All right, fair enough, so you are essentially asking if the library could support custom date formats, right? |
Yes, exactly |
We could also add locale support to datetime.extra.masks property like this:
When no locale is defined (first mask) we use en-US as default. |
I understand @FrancescoMarzullo01's use-case, but, honestly, I'd argue the correct approach here would be to fix the feed and not make the library jump through hoops to accomodate non-standard formats. There's an RFC for a reason. |
I have an RSS feed that contains lastBuildDate (feed) in rfc822 format and pubDate (entry) in Italian version of rfc822 format.
By default, the
SyndFeedInput
class uses the US locale. It is possible to set a different locale using the constructorSyndFeedInput(final boolean validate, final Locale locale)
.However, the problem is that the locale set for
SyndFeedInput
also affectsSyndEntry
, and there is no way to set the locale for SyndEntry separately.One possible solution to this problem is to create two instances of
SyndFeedInput
, one with the default locale to parse lastBuildDate, and the other with the Italian locale to parse pubDate.The text was updated successfully, but these errors were encountered: