Hi
I have a bit of code that compares two dates, one date from a form and one date from New Date().
Here is the code i wrote:
var d = new Date();
var da = (d.getDate() + "-" + (d.getMonth()+1) + "-" + d.getYear());
if (document.form1.real.value < da) {
alert("The selected date is in the past!"
;
}
The problem is as followed:
if document.form1.real.value is 19-9-2003 and
da is 2-9-2003 then the alert-line is executed. What can't be right, because 19th of September 2003 i not smaller than 2nd of September 2003! Is it?
the same proplem occurs if document.form1.real.value is between 10th and 19th.
I hope someone can help me!
Kind regards
Peter Larsen
I have a bit of code that compares two dates, one date from a form and one date from New Date().
Here is the code i wrote:
var d = new Date();
var da = (d.getDate() + "-" + (d.getMonth()+1) + "-" + d.getYear());
if (document.form1.real.value < da) {
alert("The selected date is in the past!"
}
The problem is as followed:
if document.form1.real.value is 19-9-2003 and
da is 2-9-2003 then the alert-line is executed. What can't be right, because 19th of September 2003 i not smaller than 2nd of September 2003! Is it?
the same proplem occurs if document.form1.real.value is between 10th and 19th.
I hope someone can help me!
Kind regards
Peter Larsen