question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pass invalid values to the onDateChange prop

See original GitHub issue

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 the onDateChange handler. I could see an argument for a simple boolean that’s false if the input is not a valid moment.Moment or passing the invalid input as a string. 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.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
marcgarygraycommented, Mar 6, 2020

@ljharb thanks. Submitted. 👍

0reactions
ljharbcommented, Mar 5, 2020

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 master).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pass invalid values to the onDateChange prop #1937 - GitHub
I believe it would be helpful to a lot of developers to be able to know if an invalid date has been typed...
Read more >
onDateChange returns null when user types a past date using ...
If you want to select past days, pass in isOutsideRange={() => false} prop. source <SingleDatePicker date={moment(Date.now())} ...
Read more >
KendoReact Changelog - Telerik
NumericTextBox invalid ranged values. popup: set correct display style; tooltip: wrong propType for popover title; treelist: no data rendered in ...
Read more >
Date Component - React Data Grid
You can create your own date components, and AG Grid will use them every time it needs to ask the user for a...
Read more >
React custom datepicker: Step-by-step - LogRocket Blog
HTML5 introduced a date input type to improve date values in forms. ... If a callback function is passed to the onDateChanged prop...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found