I modified one of the samples. something like that:
$(function() { $('#start-date').bind( 'dpClosed', function(e, selectedDates) { var d = selectedDates[0]; if (d) { d = new Date(d); var timeframe = $('.plan-length').val(); $('#end-date').dpSetStartDate(d.addDays(timeframe).asString()); $('#end-date').dpSetEndDate( d.addDays(timeframe + 1).asString()); } } ); });
where #start-date is the input of the start date, .plan-length is the selector that will return the number of days the plan will be added (obviously, I donβt know your implementation, so this must change). and #end-date is the entry of the end date.
EDIT: I also highly recommend you check out the jQuery UI DatePicker plugin as it is much more flexible and IMO is easier to use.
EDIT 2: You can set a start and end date, so this is just one choice. I added 1 more line to the code above.
source share