Only Month or Year views in DatePicker

1 Answer 108 Views
DatePicker
Bernd
Top achievements
Rank 5
Bronze
Bronze
Bronze
Bernd asked on 28 Jun 2024, 06:49 AM

Hi.

Is it somehow possible to restrict the DatePicker component to only show the month or the year view (see attached screenshots) ? 

In my component I have two fields. The first one should only allow a month / year input and the second one should only allow to choose a year. So I would like to use the DatePicker component but as it allows to also select a specific date in a month, that's more than I want to allow to the user.

Thanks,

Greetings,

Bernd

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Bernd
Top achievements
Rank 5
Bronze
Bronze
Bronze
answered on 28 Jun 2024, 08:02 AM | edited on 28 Jun 2024, 08:06 AM

Hi again.

Well, it was again a RTFM moment... I found the solution in you documentation.

For everyone: If you have a similar scenario as described above, here is the answer:

https://www.telerik.com/kendo-react-ui/components/dateinputs/datepicker/custom-rendering/#toc-customizing-the-calendar

For my scenario I had to customize the calendar like this:


    <MultiViewCalendar
      {...props}
      views={1}
      topView={'century'}
      bottomView={'year'}
    />

Greetings,

Bernd

Tags
DatePicker
Asked by
Bernd
Top achievements
Rank 5
Bronze
Bronze
Bronze
Answers by
Bernd
Top achievements
Rank 5
Bronze
Bronze
Bronze
Share this question
or