Date format not working in Firefox

function ds_sh(t) {

var dtToday = new Date();    
var month = dtToday.getMonth() + 1;
var day = dtToday.getDate();
var year = dtToday.getFullYear();
if(month < 10)
    month = '0' + month.toString();
if(day < 10)
    day = '0' + day.toString();

var maxDate = year + '-' + month + '-' + day;
// alert(maxDate);
$('#shootdate').attr('min', maxDate);

}

I used datepicker as shown below. Now I am able to see calendar but it should not select past dates. How do I resolve this?

$(function() {
$( “#datepicker” ).datepicker();
});

you could set the minDate to now.

http://api.jqueryui.com/datepicker/

Thank you so much @chorn.
I used it but now unable to calculate the number of days between them.

   function calculate()
{

 var date1 = new Date(document.getElementById("chkindate").value);
var date2 = new Date(document.getElementById("chkoutdate").value); var difference = date2 - date1;

var days = difference/(24*3600*1000);

var result = document.getElementById('no_of_days[2]');
    document.getElementById('no_of_days[2]').value = days;
console.log(days);
// alert(days);

}
Sponsor our Newsletter | Privacy Policy | Terms of Service