pushtell / react-bootstrap-date-picker

React-Bootstrap based date picker.
MIT License
347 stars 195 forks source link

Shouldn't DatePicker's visible input only display the component's "value" property? #118

Open giang-nghg opened 7 years ago

giang-nghg commented 7 years ago

Expected Behavior

Suppose onChange doesn't change the variable that is passed as the value property of DatePicker, e.g.

<DatePicker value={ this.state.someDate } onChange={ (value, formatted) => this.setState({ someOtherDate: value }) } />

When a new date is picked, the displayed value in the visible input box shouldn't change.

Current Behavior

The displayed value is changed to the picked date.

Context

Suppose onChange indeed change the variable that is passed as value

<DatePicker value={ this.state.date } onChange={ (value, formatted) => this.setState({ date: value }) } />

I want to prevent the displayed value to change when an unexpected error happen (e.g. failed network request). Currently even if an error occured and this.state.date isn't changed, the visible input box's value is still updated to the picked date.

Your Environment

aanguswilliams commented 7 years ago

I'm wondering the same thing. This is a pretty significant issue, no?