I have condition that when I put some value, the jqueryui datepicker shows days and when I put another value, the datepicker just shows months
function setdate(q){
var d=new Date();
if (q==1){
var type={
0:"dd-mm-yyyy",
1:"days",
};
d.setDate(d.getDate()-15);
}
else if (q==2){
var type={
0:"mm-yyyy",
1:"months",
};
d.setDate(d.getDate()-30);
}
viewdate(d,type);
}
function viewdate(d,type){
$('#from').datepicker({
format: type[0],
startView:type[1],
minViewMode: type[1]
});
$('#from').datepicker( 'setDate',d);
$('#till').datepicker({
format: type[0],
startView:type[1],
minViewMode: type[1]
});
$('#till').datepicker( 'setDate', new Date());
}
But when I put the months value, the datepicker is still showing days.