-
Notifications
You must be signed in to change notification settings - Fork 19
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
RssItem now is a Date instead of a String #9
base: master
Are you sure you want to change the base?
Conversation
Hi @eagskunst The date format is not the same for all RSS contents. It changes depends on the content. So date will be null if the format is other than |
@faruktoptas What about if there's a builder where you could add the formatter? |
@eagskunst The formatter should change depending on the RSS content. An interceptor should be better instead of the builder. You can manipulate the RssItem after it is created by intercepting. So you can change each field's value or type. |
@faruktoptas I'm not familiar with the concept of interceptors (how they're made). Could you help me a little bit so I can do it? |
Currently, it is not implemented. But I'm planning to add it to be more flexible. You can follow the steps below:
|
In my research for the ways to test all patterns of SimpleDateFormatter, I found this library, |
@faruktoptas Don't forge to give me some feedback 😅 |
try{ | ||
DateTime.parse(it, DateTimeConfig.getGlobalDefault()).toDate() | ||
}catch (e: Exception){ | ||
Log.i(XMLParser::class.java.simpleName, "Careful! ${e}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If parsing fails date will be null. But the user could parse it somehow.
@eagskunst sorry for late reply :) Trying to parse the date string could cause date to be null. But it should not be. I will add a formatter that works with RSS urls. So user can add their own formatters. It would be more flexible |
@faruktoptas What about using a formatter with the RSS specification? |
As for issue #8 and in terms for making it more simple to devs to filter Items by date, I make the necessary modifications to now have a Date inside the RssItem.
Added also a Log message in order to inform the existence of an unparseable date.
I tried to make changes in dev, but I couldn't be able to resolve the conflicts in merge.