NDA HTML
<h2>NDA Remaining Attempts Checker</h2>
<label>Enter Date of Birth:</label>
<input id="dob" type="date" /><br /><br />
<button onclick="checkAttempts()">Check Remaining Attempts</button>
<h3 id="result"></h3>
<script>
function formatDate(date) {
const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
let day = date.getDate();
let month = months[date.getMonth()];
let year = date.getFullYear();
return `${day} ${month} ${year}`;
}
function checkAttempts() {
let dob = document.getElementById("dob").value;
if (!dob) {
document.getElementById("result").innerHTML = "Please enter your Date of Birth!";
return;
}
let birthDate = new Date(dob);
let formattedDOB = formatDate(birthDate);
let birthYear = birthDate.getFullYear();
let birthMonth = birthDate.getMonth() + 1;
let birthDay = birthDate.getDate();
let attempts = [];
let ndaData = [
{ exam: "NDA 1 2025", start: "2 July 2006", end: "1 July 2009" },
{ exam: "NDA 2 2025", start: "2 Jan 2007", end: "1 Jan 2010" },
{ exam: "NDA 1 2026", start: "2 July 2007", end: "1 July 2010" },
{ exam: "NDA 2 2026", start: "2 Jan 2008", end: "1 Jan 2011" },
{ exam: "NDA 1 2027", start: "2 July 2008", end: "1 July 2011" },
{ exam: "NDA 2 2027", start: "2 Jan 2009", end: "1 Jan 2012" },
{ exam: "NDA 1 2028", start: "2 July 2009", end: "1 July 2012" },
{ exam: "NDA 2 2028", start: "2 Jan 2010", end: "1 Jan 2013" },
{ exam: "NDA 1 2029", start: "2 July 2010", end: "1 July 2013" },
{ exam: "NDA 2 2029", start: "2 Jan 2011", end: "1 Jan 2014" },
{ exam: "NDA 1 2030", start: "2 July 2011", end: "1 July 2014" },
{ exam: "NDA 2 2030", start: "2 Jan 2012", end: "1 Jan 2015" },
{ exam: "NDA 1 2031", start: "2 July 2012", end: "1 July 2015" },
{ exam: "NDA 2 2031", start: "2 Jan 2013", end: "1 Jan 2016" },
{ exam: "NDA 1 2032", start: "2 July 2013", end: "1 July 2016" },
{ exam: "NDA 2 2032", start: "2 Jan 2014", end: "1 Jan 2017" }
];
ndaData.forEach(entry => {
let startDate = new Date(entry.start);
let endDate = new Date(entry.end);
if (birthDate >= startDate && birthDate <= endDate) {
attempts.push(entry.exam);
}
});
if (attempts.length > 0) {
document.getElementById("result").innerHTML = `✅ Date of Birth: ${formattedDOB}<br><br>✅ Remaining Attempts:<br>` + attempts.join(", ");
} else {
document.getElementById("result").innerHTML = `❌ Date of Birth: ${formattedDOB}<br><br>❌ Sorry, you are not eligible for any NDA attempt.`;
}
}
</script>
Comments
Post a Comment