When there are problems with the values 08
and 09
, you almost certainly forgot to specify the radix parameter on parseInt()
.
If it's not specified, it tries to auto-detect the base from the input, and if it finds a leading zero, it tries to parse it as an octal number. For numbers 00
to 07
it's not an issue, it even evaluates to the same as if it was base-10, but for obvious reasons 08
and 09
are invalid octal numbers.
To avoid this issue in the future, make sure you always set the radix parameter to force parsing a number as base-10, regardless of the input:
var value = parseInt(someString, 10);
Check out your javascript around line 29 of your HTML file and change it to the following:
jQuery("#ValidDate").validate({
expression: "if (!isValidDate(parseInt(VAL.split('-')[2], 10), parseInt(VAL.split('-')[0], 10), parseInt(VAL.split('-')[1], 10))) return false; else return true;",
message: "Please enter a valid Date"
});