Skip to content Skip to sidebar Skip to footer

Add Business Days To The New Date

I would like to add the new date with 1 business day. For example if user select any Friday, it should display Monday's date in the second field. Below is the code: JQUERY: $(func

Solution 1:

Please check this.

$(function(){
 $('.one').datepicker({
 onSelect: function(date){
  var date2 = $('.one').datepicker('getDate');
  date2.setDate(date2.getDate()+1);
     var day2=date2.getDay();
     if(day2==0){
         date2.setDate(date2.getDate()+1);
     }
     else if(day2==6){
         date2.setDate(date2.getDate()+2);
     }
  $('.two').datepicker('setDate', date2);
  }
  })
  $('.two').datepicker({})

  });

Post a Comment for "Add Business Days To The New Date"