script is ---
function TimeSpentForFutureDate() {
var toDate = new Date();
toDate.setMinutes(0);
toDate.setSeconds(0);
toDate.setHours(0);
toDate.setMilliseconds(0);
//Here after selecting future date also, this condition is failing.The textbox
// containing a future date
if (document.getElementById('<%= txtDate.ClientID%>').value > toDate) {
var timespent = jPrompt('Enter Time Spent:', '', 'Enter Time Spent',
function (r) {
if (r) {
document.getElementById('<%=
hiddenFieldFutureDateSelectTimeSpent.ClientID%>').value = r;
jAlert('You entered ' + r);
}
else {
var todaysDate = new Date();
jAlert('You had not entered the Time Spent', 'Message');
}
});
}
else {
document.getElementById('<%=
hiddenFieldFutureDateSelectTimeSpent.ClientID%>').value =
timespent;
document.getElementById('<%= txtDate.ClientID%>').value = toDate;
}
}
In the above code I'm checking that if text box 'txtDate' will contain a future date.
[ i.e date greater then today's date it will prompt for entering time spent and then store that time spent into an hidden field.]
I'm not able to convert a string into date time object for comparison. Please help me to resolve this issue.
Thanks in advance.