I need to do a date validation to accept it in dd/mm/yyyy format. However all conditions are working fine except that if I enter year of 6 digits it is also accepting it, like - 

**12/12/200000**

as per my code is valid. Below is my code:

```
function validate(value) {
            if(!value.match(/\d\d\/\d\d\/\d\d\d\d/))
                return false;
            return checkdate(value);
}

function checkdate(val)
{
    var dates = val.split(/\D/);
    if(dates[0] <= 0 || dates[0] > 31)
        return false;
    if(dates[1] <= 0 || dates[1] > 12)
        return false;
    var now = new Date(dates[2],dates[1]-1,dates[0]);
    if (isNaN(now))
        return false;
    now.setHours(0,0,0,0);
    if (now.getFullYear() == dates[2] && now.getMonth() + 1 == dates[1] && now.getDate() == dates[0])
        return true;
    return false;
}

```

I am not sure why it allowing year as 6 digits valid input?