How to select only the year from the antd DatePicker time selector component?

how do I select only the year in the time component of antd?
because there is a DatePicker,MonthPicker, in the component api, but no YearPicker, is written to report an error, and there is no error in looking for it for a long time.
you can use format to make the selected content only years old. How can you only allow users to choose a year in the pop-up selection space? The purpose of
is to click and directly appear an interface like this

clipboard.png

but by default, you have to choose the month.
check that the build is based on momentjs, but there is no relevant method for selecting only the year in the momentjs document.
Thank you very much for your advice


officially does not provide year-only components, but you can see the underlying source code-related components of antd rc-calendar , in which there is a YearPanel.js file, and you can only select the year


ant.design, which is equivalent to the common components that have been written for you beforehand. If what is not in the document is that he has not written this component for you in advance, you have to write it yourself. To understand the positioning of ant.design clearly! Don't rely too much on ant.design,. You can't achieve functionality without it.


if you just choose a year, do you need YearPicker, input, or select?


the suggestion is to write one in the style of antd. If there is only a year, it is actually a set of li, and then the text in it is changed.

of course, as mentioned above, rc-calendar also has it, but the modification based on it is not necessarily easier to write than yourself.

In

antd, DatePicker has an attribute mode date panel status. Time | date | month | year set it to year, and you can select the year


do you have time to give the next code, then change it, not very well. Mail:294092869@qq.com


Hello, your problem has been solved. Would you please let me know if you have time to send the components of the year to my email 2389139528@qq.com? thank you


how can I click on the blank to make the DatePicker pop-up box close
when I use button to control the open property of DatePicker in antdpro? I need a button button to open DatePicker,

in the project.
Menu