DatePicker - set default month for popup

1 Answer 218 Views
Date/Time Pickers
Mikko
Top achievements
Rank 1
Mikko asked on 07 Sep 2023, 07:22 AM
Hello,

How do I set default month to popup calendar when user opens popup and no date is selected? Now calendar is opened to current month.

Thanks.
Mikko

1 Answer, 1 is accepted

Sort by
0
Zornitsa
Telerik team
answered on 11 Sep 2023, 01:45 PM

Hi Mikko,

You could achieve the desired behavior by using the navigate method of the Calendar in the DatePicker component:

$("#datepicker").kendoDatePicker({
      open: function() {
        var calendar = this.dateView.calendar;
        calendar.navigate(new Date(2023, 0, 1), "month");
       }
});

As you can observe from the above code snippet, in the open event of the component, I am accessing the calendar from the dateView of the DatePicker and then navigating to the desired month by setting a corresponding Date() object as the first parameter of the method. 

Below is a simple Dojo example, demonstrating the described approach:

Let me know if the proposed suggestion is suitable for your scenario.

Regards,
Zornitsa
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
Tags
Date/Time Pickers
Asked by
Mikko
Top achievements
Rank 1
Answers by
Zornitsa
Telerik team
Share this question
or