2

I have an issue with react-datepicker date range inputs, when I write first input field and then starts to type in second one with two same numbers, second input autofills. For example:

  1. if I input 22, it auto corrects to 2022-01-01.
  2. if I input 2020-11, it auto corrects to 2020-11-01

code:

         <DatePicker
            ref="start_date"
            selected={this.state.startDate}
            openToDate={new Date()}
            autoComplete='off'
            selectsStart
            onChange={this.handleChangeStart.bind(this)}
            startDate={this.state.startDate}
            endDate={this.state.endDate}
            maxDate={this.state.endDate}
            className="first_date_picker"
            placeholderText="yyyy-mm-dd"
            dateFormat="yyyy-MM-dd"
          />
          <DatePicker
            ref="end_date"
            selected={this.state.endDate}
            openToDate={new Date()}
            autoComplete="nope"
            selectsEnd
            onChange={this.handleChangeEnd.bind(this)}
            startDate={this.state.startDate}
            endDate={this.state.endDate}
            minDate={this.state.startDate}
            className="second_date_picker"
            placeholderText="yyyy-mm-dd"
            dateFormat="yyyy-MM-dd"
          />

How I could turn this off? Maybe some had same issue?

NotsoPr0
  • 101
  • 1
  • 4
  • 10

0 Answers0