Posts Tagged ‘Date Picker’

h1

Disable Specified Day in Datepicker

April 3, 2012

Pass the date to this function which will be disable .

Function:

function isAvailable(date)
{
dateAsString = date.getFullYear().toString() + “-” + (date.getMonth()+1).toString() + “-” + date.getDate();
var dateNo = date.getDate() < 10 ? ‘0’+date.getDate() : date.getDate();
var monthNo = (date.getMonth()+1) < 10 ? ‘0’+(date.getMonth()+1) : (date.getMonth()+1);
var dateAsString = dateNo + “/” + monthNo + “/” + date.getFullYear().toString() ;var result = $.inArray( dateAsString, HideDate) ==-1 ? [true] : [false];
return result
}

Function For DatePicker:

function
{
$(“#txtDate”).datepicker({minDate:-15,maxDate:3,beforeShowDay: isAvailable});
}
Advertisements