I have a function which convert date to my formatdate and compare it to CurrentDate. It worked well when I test it with date is a date in Octorber compare to today (16/10/2013) But if date is a date in November, the value return is true which means date < currentdate. I dont know why, anyone can explain it to me ? Thanks so much.
function IsPast(date) {
var fullDate = new Date();
var twoDigitMonth = fullDate.getMonth() + 1 + "";
if (twoDigitMonth.length == 1) twoDigitMonth = "0" + twoDigitMonth;
var twoDigitDate = fullDate.getDate() + "";
if (twoDigitDate.length == 1) twoDigitDate = "0" + twoDigitDate;
var currentDate = twoDigitDate + "/" + twoDigitMonth + "/" + fullDate.getFullYear();
var startDate = $.fullCalendar.formatDate(date, 'dd/MM/yyyy');
if (startDate <= currentDate) {return true;}
return false;
}