<code>
function valiDate(obj, min, max, format){
dateBits = dateComponents(obj.value, format);
if (dateBits == null) return false;
//Check it is a valid date first
...
//Now check whether a range is specified and if in bounds
var theDate = new Date(dateBits[2], parseInt(dateBits[1],<b>10</b>) -
1, dateBits[0]);
if ( min ) {
minBits = dateComponents (min, format);
var minDate = new Date(minBits[2], parseInt(minBits[1],<b>10</b>) - 1,
minBits[0]);
if ( minDate.getTime() > theDate.getTime() ) return false;
}
if ( max) {
maxBits = dateComponents (max, format);
var maxDate = new Date(maxBits[2], parseInt(maxBits[1],<b>10</b>) - 1,
maxBits[0]);
if ( theDate.getTime() > maxDate.getTime() ) return false;
}
return true;
}
</code>
Interestingly i did notice that you have used the bug fix on this post
http://www.codestore.net/store.nsf/cmnts/F3E50993039AF1EB86256C10002FA6A5?OpenDo
cument
...
Easy fix shown below.
<code> function valiDate(obj, min, max, format){ dateBits = dateComponents(obj.value, format); if (dateBits == null) return false;
//Check it is a valid date first ... //Now check whether a range is specified and if in bounds var theDate = new Date(dateBits[2], parseInt(dateBits[1],<b>10</b>) - 1, dateBits[0]);
if ( min ) { minBits = dateComponents (min, format); var minDate = new Date(minBits[2], parseInt(minBits[1],<b>10</b>) - 1, minBits[0]); if ( minDate.getTime() > theDate.getTime() ) return false; } if ( max) { maxBits = dateComponents (max, format); var maxDate = new Date(maxBits[2], parseInt(maxBits[1],<b>10</b>) - 1, maxBits[0]); if ( theDate.getTime() > maxDate.getTime() ) return false; } return true; } </code>
Interestingly i did notice that you have used the bug fix on this post http://www.codestore.net/store.nsf/cmnts/F3E50993039AF1EB86256C10002FA6A5?OpenDo cument
(Thanks for the cool work jake)