React-datepicker: Year Picker doesn't show when adding `showYearPicker`

Created on 7 May 2020  路  3Comments  路  Source: Hacker0x01/react-datepicker

Describe the bug
Adding showYearPicker prop to show only year picker. But it shows a full calendar.

To Reproduce
Creating a DatePicker component with the simplest options:

() => {
  const [startDate, setStartDate] = useState(new Date());
  return (
    <DatePicker
      selected={startDate}
      onChange={date => setStartDate(date)}
      showYearPicker
      dateFormat="yyyy"
    />
  );
};

Expected behavior
Calendar only shows Year Picker as in Example

Screenshots
If applicable, add screenshots to help explain your problem.

image
image

Additional context
Double check the source code and this property might be missing. Tried showMonthYearPicker and this works.

Most helpful comment

Can you try this again with v2.15.0?

All 3 comments

This will be released in the next version, stay tuned.

Can you try this again with v2.15.0?

Can you try this again with v2.15.0?

Thanks for the quick update, v2.15.0 resolved this ticket

Cheers,
Duc

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arturictus picture arturictus  路  3Comments

kkras3 picture kkras3  路  3Comments

sarav1234 picture sarav1234  路  3Comments

jbccollins picture jbccollins  路  3Comments

jjjss94 picture jjjss94  路  3Comments