Open sankho opened 7 years ago
just covering my bases here but sorry if I'm being dumb and just missing some obvious option. Thanks!
There is the onBlur()-function which you could use to detect if the user leaves focus and then do a manual check of the value.
...
value={this.state.date}
onBlur={(e) => {
const typedDate = new Date(e.target.dataset.formattedvalue);
this.setState({date: typedDate})
}}
...
Don't forget to check if the new Date is invalid. Could happen if the user enteres something like "2018/01//////23425345"
@p4sI if user clicks a button directly after fill the datepicker onBlur never is going to be trigger.
If the user uses the text input and manually erases the date,
onChange
is never called to reflect this, leaving undefined / false values as possibly undetectable.Expected Behavior
onChange
should be called withundefined
values.Current Behavior
onChange
event never fires.Steps to Reproduce (for bugs)
onChange
handler to verify it runsonChange
Context
Although there is the "x" button, users still get confused as to why clearing out the date manually doesn't work.
Your Environment