Search code examples
reactjsreact-datepicker

How to pick multiple dates in one go with react-datepicker?


I know that there are other packages which help in picking multiple dates. But is there any way I can do this using react-datepicker only?


Solution

  • If you are referring to a date range you can use the following format,

    <DatePicker
      selected={this.state.startDate}
      onChange={this.handleChange}
      minDate={moment()}
      maxDate={moment().add(5, "days")}
      placeholderText="Select a date between today and 5 days in the future"
    />
    

    But if you want to pick multiple non continous dates, you will have to refocus on the Date picker component in the onChange function so that the date picker will reappear and pick a date again.