javascript - Set mindate in bootstrap datepicker -
i have 2 date picker on change of 1st date picker need set selected date mindate value of 2nd date picker . here coe
<input type="text" size="30" class="date_picker_from form-control valid" id="start" value="" name="start" aria-invalid="false"> <input type="text" size="30" class="date_picker_to form-control valid" id="end" value="" name="end" aria-invalid="false"> $('.date_picker_from').datepicker({ setdate: new date(), format: 'dd/mm/yyyy', todayhighlight: true, autoclose:true, startdate: '-0m', mindate:0, }); $('.date_picker_to').datepicker({ //setdate: new date(), format: 'dd/mm/yyyy', todayhighlight: true, autoclose:true, startdate: '+1d', mindate:0, }); $("#start").change( function() { var seconddate = new date($("#start").datepicker( "getdate" )); var date2 = new date(seconddate.gettime()); date2.setdate(date2.getdate() + 1); $("#end").datepicker("setdate", date2); $("#end").datepicker("mindate", date2); $('#end').datepicker( "option", "mindate", date2 ); });
here jsfiddle link
this thing need set mindate.this way set mindate using datepicker.
$("#start").change( function() { $( ".date_picker_hotel_to" ).datepicker("option", "mindate", $("#start").val()); });
Comments
Post a Comment