Reputation: 155
if have two date picker 1 for checkin date and other for checkout i want if i select 28-06-2012 in checkin it autmatic disable dates befor 29-06-2012 in checkout date picker Here's the code
$(document).ready(function () {
function getDateYymmdd(value) {
if (value == null)
return null;
return $.datepicker.parseDate("yy-mm-dd", value);
}
$('.date').datepicker({ minDate: 1, dateFormat: "dd-mm-yy" });
$('.date').each(function () {
var minDdate = getDateYymmdd($(this).data(""));
var maxDate = getDateYymmdd($(this).data("val-rangedate-max"));
$(this).datepicker({
maxDate: maxDate
});
});
});
Upvotes: 0
Views: 252
Reputation: 572
You are using bootstrap date picket, There is some Default function defines,
I have Something Like this: May This helps you also
jQuery(".dateone").datepicker({
dateFormat:"yy-mm-dd",
changeMonth: true,
changeYear: true,
minDate: 1,
});
jQuery(".datetwo").datepicker({
dateFormat:"yy-mm-dd",
changeMonth: true,
changeYear: true,
minDate: new Date($('.dateone').val()),
});
Upvotes: 1
Reputation: 1940
Use "Jquery Ui Date picker ", DatePicker with Date Range Demo
Upvotes: 2
Reputation: 5933
$( "#frmDateStatusLog").datepicker({
onSelect: function(dateText, inst){
$("#toDateStatusLog").datepicker("option","minDate",$("#frmDateStatusLog").datepicker("getDate"));
}
});
$( "#toDateStatusLog").datepicker({
minDate: $("#frmDateStatusLog").datepicker("getDate")
});
Upvotes: 0