Wednesday, January 11, 2012

Add days to selected date


 $('#txttFrom').change(function () {
                var date2 = $('#txtFrom').datepicker('getDate', '+1d');
                date2.setDate(date2.getDate() + 60);
                $('#txtTo').datepicker('setDate', date2);
            });

------------OR--------------
  $('#txtDate').datepicker({ onSelect: function (dateStr) {
            var date = $(this).datepicker('getDate');
            if (date) {
                date.setDate(date.getDate() + 1);
                // Do something with date + 1
            }
        }
        });

2 comments:


  1. var currentDate = new Date();
    var dateLimit = new Date(Date.parse(new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate() + 5)));

    ReplyDelete