skratchdot / react-bootstrap-daterangepicker

A date/time picker for react (using bootstrap). This is a react wrapper around the bootstrap-daterangepicker project.
http://projects.skratchdot.com/react-bootstrap-daterangepicker/
Other
474 stars 203 forks source link

Update startDate endDate #176

Closed SagiSan closed 4 years ago

SagiSan commented 6 years ago

Hi...How can update the startDate and endDate based on state. Are there any method like in jQuery version of picker?

isaacs-gh commented 6 years ago

You pass the start/end dates as props into the DateRangePicker component and you define the onApply function prop to update the state:

//...
handleDateRangeApply = (startDate, endDate) => {
  this.setState({startDateTime: startDate.valueOf(), endDateTime: endDate.valueOf()});
}
//...
<DateRangePicker
          startDate={moment(this.state.startDateTime)}
          endDate={moment(this.state.endDateTime)}
          onApply={this.handleDateRangeApply}
>
//...
isaacs-gh commented 5 years ago

Are you sure it is passing the redux connected props into the DateRangePicker component? Provide some sample code to make it easier to assist.

vaseems commented 5 years ago

Are you sure it is passing the redux connected props into the DateRangePicker component? Provide some sample code to make it easier to assist.

Please ignore. I was passing incorrect attributes. it's working fine now. Thanks for the reply.

skratchdot commented 4 years ago

closing this due to inactivity. please re-open if this is still an issue in v6.0.0 or greater