Disable previous months in MultiDatesPicker Full year View

493 Views Asked by At

I have a jQuery MultiDatesPicker calendar (https://dubrox.github.io/Multiple-Dates-Picker-for-jQuery-UI/) in my Asp.net page which shows a full year calendar.

I want do disable the previous months, For example, if I am using the page in September, I want to see the months January to August Disabled.

Currently the calendar loads perfectly with full year with this code.

$('#mdp').multiDatesPicker({
                dateFormat: "m/d/yy",
                firstDay: '1/1/2019',
                numberOfMonths: [3, 4],
                defaultDate: '1/1/2019'
            });

enter image description here

I tried to disable previous month by adding a MinDate and MaxDate element.

 $('#mdp').multiDatesPicker({
                dateFormat: "m/d/yy",
                firstDay: '1/1/2019',
                numberOfMonths: [3, 4],
                defaultDate: '1/1/2019',
                maxDate: '12/31/2019',
                minDate: '7/1/2019'
            });

This does not work as expected. This removes the previous months from the view itself, and shows dates of 2020.

enter image description here

I want the view to display from january 2019 to december 2019. Just the January to July months need to be disabled.

How can I achieve this?

1

There are 1 best solutions below

0
Kishan Dudhatra On

please change this line

numberOfMonths: [3, 2]

Your Disabled moth are remove.