1
0
-1

Hi 

How can i disable weekends from the date picker. I have two date pickers "From" and "Till" and a "text box" for calculating the difference of the these two dates (using java script). I would also like this to reflect in the calculation.

JavaScript code for calculating the date difference 

<script type="text/javascript">
$('input[name="leavePeriodFrom"], input[name="leavePeriodTo"]').change(function(){
d1 = $('input[name="leavePeriodFrom"]').datepicker('getDate');
d2 = $('input[name="leavePeriodTo"]').datepicker('getDate');
diff = 0;
if (d1 && d2) {
diff = 1+Math.floor((d2.getTime() - d1.getTime())/ 86400000); // ms per day
}
$('input[name=days]').val(diff);
document.getElementById('days').readOnly = true;
});
</script>

 

Many  thanks in advance.

Kamran

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi Kamran Raza

      Thank you for your question but the javascript communitymight be able to help you, example here.

        CommentAdd your comment...