Skip to content

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

@agilgur5

Description

@agilgur5

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions