The parseInt() function has the second optional radix parameter. If the radix parameter is omitted, JavaScript assumes the following:
- If the string begins with "0x", the radix is 16 (hexadecimal)
- If the string begins with "0", the radix is 8 (octal). This feature is deprecated
- If the string begins with any other value, the radix is 10 (decimal)
So in your case it assumes the octal numbers. Change to var MM = parseInt(date[1], 10);
and it will work