Calculate the difference between current date and age from personal ID
In this answer I'll just reveiw the way you calculate the age difference.
So first, I would like to mention, that you should really work with four-digit numbers for displaing years - if that's possible for you.

In the suggestion below you'll see, that I don't compare the years, months and days because comparing two timestamps is better!
So you just have to feed the is25YearsOld function with a yyyymmdd-date and it will tell if you are older/younger than 25.



function is25YearsOld(input) {
    // the date of birth of a 25 year old
    var dob25 = new Date();
    // setFullYear to the current year (eg. 2016) and subtract 25
    dob25.setFullYear(dob25.getFullYear() - 25);
    // set the time to midnight
    dob25.setHours(0);
    dob25.setMinutes(0);
    dob25.setSeconds(0);
    // get the unix-timestamp
    dob25 = dob25.getTime();
    // the user's date of birth
    var dob = new Date();
    // set the year, month and day accordingly to the input
    dob.setFullYear(parseInt(input.substr(0, 4)));
    dob.setMonth(parseInt(input.substr(4, 2)) - 1); // (-1) because month is zero-based
    dob.setDate(parseInt(input.substr(6, 2)));
    // set the time to midnight
    dob.setHours(0);
    dob.setMinutes(0);
    dob.setSeconds(0);
    // get the unix-timestamp
    dob = dob.getTime();
    // if the timestamp of requiredDateOfBirth is smaller than the one of dateOfBirth, the user is too young
    return dob25 &gt;= dob;
}

// Oct 10, 2008
document.getElementById("test1").innerHTML = is25YearsOld("20081010") ? "You are old enough!" : "You are too young!";
// Oct 10, 1988
document.getElementById("test2").innerHTML = is25YearsOld("19881010") ? "You are old enough!" : "You are too young!";
&lt;p&gt;2008-10-10: &lt;span id="test1"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;1988-10-10: &lt;span id="test2"&gt;&lt;/span&gt;&lt;/p&gt;