How to restrict date range of a jquery datepicker by giving two dates?
Posted
by
Harie
on Stack Overflow
See other posts from Stack Overflow
or by Harie
Published on 2010-12-27T10:00:04Z
Indexed on
2010/12/29
6:53 UTC
Read the original article
Hit count: 232
I am having two dates that is stored in db and am selecting it using $.ajax() and what i need is to show the datepicker values between the dates I selected from db.
Here is my code for it.But it is not working properly
function setDatePickerSettings(isFisc) {
var fSDate, fEDate;
$.ajax({
type: "POST",
url: '../Asset/Handlers/AjaxGetData.ashx?fisc=1',
success: function(data) {
alert(data);
var res = data.split("--");//data will be 4/4/2010 12:00:00--5/4/2011 12:00:00
var sDate = res[0].split(getSeparator(res[0]));
alert("Separator " + getSeparator(res[1]) + " Starts " + sDate);
var eDate = res[1].split(getSeparator(res[1]));
alert("End " + eDate);
alert("sub " + sDate[0]);
fSDate = new Date(sDate[2].substring(0, 4), sDate[0], sDate[1]);
alert("Starts " + fSDate.substring(0, 4));
fEDate = new Date(eDate[2].substring(0, 4), eDate[0], eDate[1]);
alert("eND " + fEDate.toString());
}
});
var dtSettings = {
changeMonth: true,
changeYear: true,
showOn: 'both',
buttonImage: clientURL + 'images/calendar.png',
buttonImageOnly: true,
showStatus: true,
showOtherMonths: false,
dateFormat: 'dd/mm/yy',
minDate:fSDate, //assigning startdate
maxDate:fEDate //assigning enddate
};
return dtSettings;
}
Pls provide some solution. I need the datetime picker which requires values between that range. Thanks in advance
© Stack Overflow or respective owner