-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Pass invalid values to the onDateChange prop #1937
Comments
NoteThis is for the |
If there's a nonbreaking way to also pass the original input string, I'd be open to that. I think this might be a duplicate of #1023? |
@ljharb |
Yes, absolutely! Tests are a requirement; a storybook story is nice but not required. It'd be ideal to make this change on every component in the library, so that everything can follow similar patterns. |
@ljharb working on this tonight. |
The workflow in general terms for making a PR to any open source project is to fork the repo, make a branch on the fork with your changes, and then make a PR to merge that to the source's default branch (usually |
@ljharb thanks. Submitted. 👍 |
I believe it would be helpful to a lot of developers to be able to know if an invalid date has been typed by the user into the
<input type="text">
node. In my opinion, the most logical place to provide that information would be in theonDateChange
handler. I could see an argument for a simpleboolean
that'sfalse
if the input is not a validmoment.Moment
or passing the invalid input as astring
.I know that an invalid input just passes
null
as the date to the handler, but that being the case, there's no way to differentiate between the user simply clearing the data (a valid interaction) versus entering text that can't be parsed into a valid date (an invalid interaction).If you allow pull requests from the masses, I would be more than happy to make the change and submit a PR.
The text was updated successfully, but these errors were encountered: