I'm having trouble with trying to enable a Material-UI DatePicker to only receive year, the user won't be able to put or select month and day. I've already tried some options, but is still not working. Anybody have a solution for this?
I'm having trouble with trying to enable a Material-UI DatePicker to only receive year, the user won't be able to put or select month and day. I've already tried some options, but is still not working. Anybody have a solution for this?
Share Improve this question asked Aug 12, 2019 at 16:19 Hiago ReisHiago Reis 211 silver badge2 bronze badges 2-
I've already tried some options, but is still not working
What other options did you try? :) – Sharon Commented Aug 12, 2019 at 16:28 - Hi! Try to be more specific to your issue by adding an example on code you trying to solve. – Lucho Commented Aug 12, 2019 at 16:29
1 Answer
Reset to default 6There is a prop called views
which is exactly for this purpose. It receives an array of types that should be rendered:
Array<"year" | "date" | "month">
So just pass year
to it:
<DatePicker views={['year']} />
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745371725a4624823.html
评论列表(0条)