The year drop-down option is not displayed
P粉060528326
P粉060528326 2024-03-29 17:45:37
0
1
318

In react-datepicker, the year dropdown is not shown, all attributes are passed. But the year dropdown is still missing.

<DatePicker
  name={props.inputName}
  id={props.dateBoxId}
  placeholderText={props.placeholderText}
  autoComplete="off"
  dateFormat={props.dateFormat}
  selected={props.value}
  onChange={(e) => props.changeSelection(e, props.inputName)}
  timeInputLabel="Time:"
  disabled={props.disabled !== undefined ? props.disabled : false}
  showTimeInput={props.showTimeInput}
  minDate={subDays(new Date(), props.minDate)}
  maxDate={addDays(new Date(), props.maxDate)}
  onKeyDown={(e) => {
    e.preventDefault();
  }}
  showMonthDropdown
  showYearDropdown
  yearDropdownItemNumber={15}
  scrollableYearDropdown
/>;

P粉060528326
P粉060528326

reply all(1)
P粉208469050

Try increasing the yearDropdownItemNumber value to 50. The possible reason is that it selects the minimum and maximum dates of the current year, and in the year dropdown, it shows 1997, while your current yearDropdownItemNumber value is only 15.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template