Set start date min value to end date minus 90 days

309 Views Asked by At
$(document).ready(function () {
                debugger;
                var startDate = $find('<%= RdpStartDate.ClientID %>');
                var endDate = $find('<%= RdpEndDate.ClientID %>');
                var end = endDate.get_selectedDate();
                var start = startDate.get_selectedDate();
                startDate.set_minDate(end-90);
              
                });

I'm trying to set start date min value to less than 90 days of end date all before that disabled but this isn't working, help please.

1

There are 1 best solutions below

3
On

Try to do change the code to the following:

end.setDate(end.getDate() - 90);
startDate.set_minDate(end);

Update:

const endNinety = new Date();
endNinety.setDate(end.getDate())
endNinety.setDate(endNinety.getDate() - 90);
startDate.set_minDate(endNinety);