-
Notifications
You must be signed in to change notification settings - Fork 268
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
CSV parse - setting cast_date to true is converting unparsable strings to dates #342
Comments
Hum, as a matter of fact, |
Hiya! Right sorry you're correct on that parsing.
I've tried to pass a function to
I'm getting the error:
Also had a question about the types -
Shouldn't the return type be |
Strange, option |
Describe the bug
Using
csv-parse: 5.0.4
When
cast_date
is set to true, if you parse a string that ends with a number, the string is cast to a date.According to the docs https://csv.js.org/parse/options/cast_date/, "The implementation relies on
Date.parse
. The CSV value is left untouched if the function returns NaN."Date.parse("Test 2") => NaN, however the parsed field is returned as
2001-02-01T00:00:00.000Z
To Reproduce
with file
test.csv
and implementation
returned data is:
The text was updated successfully, but these errors were encountered: