-
Notifications
You must be signed in to change notification settings - Fork 99
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
should parse fail when out of range? #47
Comments
I encountered the same issue. Looking at the d3 code it seems that actually it's the JavaScript Date constructor that is responsible for this behavior, and d3 just uses the Date constructor to create the final result. I can't imagine how this behavior could ever be useful, and it certainly caused problems for me: in my use case when the user supplied data changed its format from month-day-year to day-month-year, my app produced nonsense results instead of throwing an error. I also wanted to use d3 for automatically detecting the format by trying out different patterns, but it can't distinguish between month-day-year and day-month-year because of this issue. It would be great if d3 could validate if some fields are out of range, maybe using a flag for "extra strict" behavior. |
I think this would be difficult to implement, and I don’t have any current plans to support this feature, but it might make a good contribution if someone is interested. |
Is this behavior expected?
I read from README
%m - month as a decimal number [01,12].
, so I would liked3TimeFormat.timeParse('%m/%d/%Y')('26/1/2017')
to return null, is that possible?Thank you.
The text was updated successfully, but these errors were encountered: