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

[metascrapper-date] 2001 is default year for Date('Jun 20') #241

Closed
2 tasks done
slavaGanzin opened this issue Dec 10, 2019 · 0 comments
Closed
2 tasks done

[metascrapper-date] 2001 is default year for Date('Jun 20') #241

slavaGanzin opened this issue Dec 10, 2019 · 0 comments

Comments

@slavaGanzin
Copy link
Contributor

slavaGanzin commented Dec 10, 2019

Prerequisites

  • I'm using the last version.
  • My node version is the same as declared as package.json.

Subject of the issue

When date is presented omitting year, for example Jun 20. Chrome/NodeJS new Date will not produce NaN as it should and will output 2001-06-11T21:00:00.000Z which is total mess.
while chrono parse it right:

> chrono.parseDate('Jun 12'); 
2019-06-12T09:00:00.000Z

You can find date in this format here:
https://vicki.substack.com/p/keybase-and-the-chaos-of-crypto

Proposition

completely remove native parsing and use crono as reliable parser:
https://github.com/microlinkhq/metascraper/blob/master/packages/metascraper-helpers/index.js#L201-L202

p.s. I don't know why Date / chrono add 21 and 9 hours to date respectivly, but I think it's negligible if date has no year.

slavaGanzin added a commit to slavaGanzin/metascraper that referenced this issue Dec 10, 2019
slavaGanzin added a commit to slavaGanzin/metascraper that referenced this issue Dec 10, 2019
slavaGanzin added a commit to slavaGanzin/metascraper that referenced this issue Dec 10, 2019
slavaGanzin added a commit to slavaGanzin/metascraper that referenced this issue Dec 10, 2019
slavaGanzin added a commit to slavaGanzin/metascraper that referenced this issue Dec 10, 2019
slavaGanzin added a commit to slavaGanzin/metascraper that referenced this issue Dec 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant