Hi,
I have to set the startdate/Mindate in jquery datapicked calender. i am using datepicker v1.7.2. and using mindate and max date prpperty but its not working fine.
Hi,
I have to set the startdate/Mindate in jquery datapicked calender. i am using datepicker v1.7.2. and using mindate and max date prpperty but its not working fine.
Try this code. In this the end date is 1 day after start date.
$('#enddate').datepicker({
dateFormat: "dd M yy",
beforeShow: customRange,
//Your other configurations.
});
function customRange(input) {
if (input.id == "enddate")
{
dateMin = new Date();
if ($("#startdate").datepicker("getDate") != null)
{
dateMin = $("#startdate").datepicker("getDate");
dateMin.setDate(dateMin.getDate() + 1); //here we are adding 1 day to start date/
}
}
return {
minDate: dateMin
};
}
Hi,
here i am using the the "onSelect" and "beforeShow"but one of them will call at the time if i am using beforeShow then "onSelect" will not work. Please help...
afterEditCell: function (id,name,val,iRow,iCol){
CEditrow = iRow;
CEditcol = iCol;
var End_Date = jQuery("#"+iRow+"_EDate","#TaskGrid");
var Start_Date = jQuery("#"+iRow+"_SDate","#TaskGrid");
End_Date.datepicker({
beforeShow: function(input, inst){
var RowData = grid.getRowData(id);
var Sdate = RowData.SDate;
dateMin = new Date(Sdate);
if (Sdate != null)
{
dateMin.setDate(dateMin.getDate() + 1); //here we are adding 1 day to start date/
}
return {
minDate: dateMin
};
}
});
End_Date.datepicker({
onSelect: function(dateText, inst) {
var x = new Date();
var CurrentDate = new Date(x.getFullYear(), x.getMonth(), x.getDate());
var RowData = grid.getRowData(id);
var Status = RowData.Complete;
var EndDate = new Date(dateText);
var datDiff = days_between(CurrentDate,EndDate)
var cellid = 0;
if (EndDate >= CurrentDate && Status == 'Incomplete')
{
while(cellid < 8)
{
jQuery('#TaskGrid').setCell(id,cellid,'',{'background-color': 'red'});
cellid++;
}
}
else if(datDiff <= 5 && Status == 'Incomplete')
{
while(cellid < 8)
{
jQuery('#TaskGrid').setCell(id,cellid,'',{'background-color': 'orange'});
cellid++;
}
}
else
{
while(cellid < 8)
{
jQuery('#TaskGrid').setCell(id,cellid,'',{'background-color': 'white'});
cellid++;
}
}
}
});
if(name=='SDate') {
jQuery("#"+iRow+"_SDate","#TaskGrid").datepicker({dateFormat:"yy/mm/dd"});
}
if(name=='EDate') {
jQuery("#"+iRow+"_EDate","#TaskGrid").datepicker({dateFormat:"yy/mm/dd"});
}
},
});