I’m trying to validate that two dates are in the correct order. The “from” <= the “to” date for it to be valid. The code I’m using is:
<script>
function todayDate(from, to)
{
var f = new Date(from);
var n = new Date(to);
if (f <= n)
{
return true;
}
else
{
alert(“Please enter a valid date range.”);
return false;
}
}
</script>
<form action=”xfi_info_lookup_results.asp” method=”get” name=”xfi_info” target=”_blank” id=”xfi_info”
onsubmit=”return todayDate(document.xfi_info.txtShipFromDate.value,document.xfi_info.txtShipToDate.value)”>
…I think the problem is in my date formats, instead of using dd/mm/yyyy I’m using dd-mmm-yyyy (i.e. 20-JAN-2004). I’m actually completing the date fields with a calndar script and modifying the date format with an array function.