React Datepicker exclude past dates

Maybe you can use the component like that:

<DatePicker
  selected={this.state.startDate}
  onChange={this.handleChange}
  minDate={moment().toDate()}
  placeholderText="Select a day"
/>

You can use minDate and maxDate props to select a unique range of date selectable.


<DatePicker
selected={this.state.startDate}
onChange={this.handleChange}
minDate={new Date()}
/>

Things are little more simplified now. According to official https://reactdatepicker.com/

we can also use

  maxDate={addDays(new Date(), 5)} // 5 is number of days from today