Reputation: 1805
I am using react-datepicker just like below having minDate property.
<DatePicker
className="form-control"
minDate={new Date()}
selected={this.props.GrantExpiryDate}
onChange={(e) => { this.props.onGrantExpiryDateSubmit(e); }}
disabled={disableControl} />
{this.props.GrantExpiryDate == null ? <div className={styles.requiredValidation}>Please select a date</div> : ''}
If I select the Date by using DatePicker its worked fine as shown in the snap.
but when I entered date by manually typing in the date picker control it's allows me to enter older dates those are disabled.
I know this can be handled through the custom function but still this is not behavior which i was expecting from minDate property.
Is there any property or something to overcome this problem.
Upvotes: 0
Views: 986
Reputation: 1746
try to use this
<DatePicker
...
onChangeRaw={e => e.preventDefault()}
/>
Upvotes: 1