i want to set minDate and maxDate property dynamically for datetimepicker in bootstrap,please help me out in this.
in this scenario, while while selecting the date in one datetimepicker it should set that selected date as minDate for other datetimepicker.
and after selecting the date in second datetimepicker,its selected date should become maxDate in first date time picker.
i tried this way:
$(document).ready(function(){
$(".form_datepicker_startdate").datetimepicker({
isRTL: App.isRTL(),
format: "yyyy-mm-dd",
weekStart: 1,
todayBtn: 1,
autoclose: 1,
todayHighlight: 1,
startView: 2,
minView: 2,
startDate:'<%= request.getSession().getAttribute("startdate") %>',
endDate:'<%= request.getSession().getAttribute("enddate") %>',
forceParse: 0,
pickerPosition: (App.isRTL() ? "bottom-right" : "bottom-left")
}).on('changeDate', function (selected) {
var minDate = new Date(selected.date.valueOf());
$('.form_datepicker_enddate').datepicker('setMinDate', minDate);
});
$(".form_datepicker_enddate").datetimepicker({
isRTL: App.isRTL(),
format: "yyyy-mm-dd",
weekStart: 1,
todayBtn: 1,
autoclose: 1,
todayHighlight: 1,
startView: 2,
minView: 2,
startDate:'<%= request.getSession().getAttribute("startdate") %>',
endDate:'<%= request.getSession().getAttribute("enddate") %>',
forceParse: 0,
pickerPosition: (App.isRTL() ? "bottom-right" : "bottom-left")
}).on('changeDate', function (selected) {
var maxDate = new Date(selected.date.valueOf());
$('.form_datepicker_startdate').datepicker('setMaxDate', maxDate);
});
});
jQuery('.inputele').datepicker('setStartDate',{datevalue});
or clear usingjQuery('.inputele').datepicker('setStartDate',false);
– bharat