I have been trying to solve this puzzle for last 2 days,but could not know where am i doing wrong. Problem : I have two dropdowns of jquery calendar where first input has the default date set for today. when selecting a date from this input the second input should select its date as the minimum allowed date.
I have achieved so far with the below code.
$.datetimepicker.setLocale('en');
var currentdate = new Date();
var datetime = currentdate.getDate() + "/"
+ (currentdate.getFullYear()) + "/"
+ (currentdate.getMonth()+1) + " "
+ currentdate.getHours() + ":"
+ currentdate.getMinutes();
function getCurrentDate(){
var currentdate = new Date();
var datetime1 = (currentdate.getDate()+1) + "/"
+ (currentdate.getMonth()+1) + "/"
+ (currentdate.getFullYear()) + " "
+ (currentdate.getHours()+3) + ":"
+ currentdate.getMinutes();
var datetime2 = (currentdate.getDate()+1) + "/"
+ (currentdate.getMonth()+1) + "/"
+ (currentdate.getFullYear()) + " "
+ "11:59 PM";
$('#datetimepicker,#datetimepicker1,#datetimepicker2,#datetimepicker3').datetimepicker({step:30});
$('#datetimepicker').datetimepicker({
onClose: function(selectedDate) {
$( "#datetimepicker1" ).datetimepicker({minDate:selectedDate,startDate:selectedDate} );
}
});
//document.getElementById('datetimepicker').value=datetime1
//document.getElementById('datetimepicker1').value=datetime2
//document.getElementById('datetimepicker2').value=datetime1
//document.getElementById('datetimepicker3').value=datetime1
}
$('#datetimepicker').datetimepicker({
dayOfWeekStart : 1,
lang:'en',
disabledDates:['1986/01/08','1986/01/09','1986/01/10'],
startDate: datetime,
minDate : datetime
});
$('#datetimepickerr1').datetimepicker({
dayOfWeekStart : 1,
lang:'en',
disabledDates:['1986/01/08','1986/01/09','1986/01/10'],
startDate: datetime,
minDate : datetime
});
$('#datetimepicker1').datetimepicker({
dayOfWeekStart : 1,
lang:'en',
disabledDates:['1986/01/08','1986/01/09','1986/01/10'],
});
$('#datetimepicker2,#datetimepicker3').datetimepicker({
dayOfWeekStart : 1,
lang:'en',
disabledDates:['1986/01/08','1986/01/09','1986/01/10'],
startDate: datetime,
minDate : datetime
});
$('#datetimepicker,#datetimepicker1,#datetimepicker2,#datetimepicker3').datetimepicker({step:30});
$('#datetimepicker').datetimepicker({
onClose: function(selectedDate) {
$( "#datetimepicker1" ).datetimepicker({minDate:selectedDate,startDate:selectedDate} );
}
});
Issue :: When I select a date from second dropdown,it changes the min allowed date for the first input.
It can be seen live at http://ift.tt/298XK6O
Aucun commentaire:
Enregistrer un commentaire