Skip to content
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

"hours ago" / "days ago" results in Invalid Date #20

Closed
agilgur5 opened this issue Nov 9, 2019 · 2 comments · Fixed by #22
Closed

"hours ago" / "days ago" results in Invalid Date #20

agilgur5 opened this issue Nov 9, 2019 · 2 comments · Fixed by #22
Labels
bug Something isn't working

Comments

@agilgur5
Copy link
Owner

agilgur5 commented Nov 9, 2019

Apparently some providers say "2 hours ago" or "1 day ago" etc. instead of giving a date when the chapter is recent, so just calling new Date() on that text makes it result in Invalid Date and also makes it unable to determine that the chapter is new. Related to #7 and #15, that it appears in, and #18 needs this to be fixed.

The simple fix would be just to detect if there's an "ago" in the text and just make the Date equivalent to now instead. A more complex fix would be to actually parse out the number of days or hours and subtract them from the current datetime. Probably gonna go with simpler fix for now; shouldn't be a huge deal, though people who know their release dates might be a bit confused by it, so not ideal.

Also noting that this is actually handled in the scraper code right now, so it's not in the repo. After #6 is completed, we can then think of moving some common transforms into the API code, but right now it's unclear how much will be similar or re-used between them.

@agilgur5 agilgur5 added the bug Something isn't working label Nov 9, 2019
@agilgur5
Copy link
Owner Author

agilgur5 commented Nov 9, 2019

Ok, fixed this and planning to release either in v0.2.0 or v0.2.1 with other bug fixes (found #21 in the process of fixing this). Expo allows re-publishing the same version, so shouldn't be an issue for v0.2.0. v0.2.1 would have to be with other bugs as the code for this fix is in gitignore'd scraper code.

Also noting that there are options other than "hours ago" it could be, like "Today" or "Yesterday", at least in this provider, so I added logic to handle all those variants.

@agilgur5
Copy link
Owner Author

Wanted to commit the fix for this and otherwise version control the scraper code, so I've decided to expose some of it and add the commit that fixes this in #22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant