Posts

Showing posts from September, 2024

age creator

function calculateAge(event) { event.preventDefault(); const dob = new Date(document.getElementById('dob').value); const today = new Date(); // Calculate age components let ageInYears = today.getFullYear() - dob.getFullYear(); let ageInMonths = today.getMonth() - dob.getMonth(); let ageInDays = today.getDate() - dob.getDate(); // Adjust for negative months/days if (ageInDays Age: ${ageInYears} years ${ageInMonths} months ${ageInDays} days or ${totalMonths} months ${ageInDays} days or ${totalWeeks} weeks ${ageInDays} days or ${totalDays} days or ${totalHours} hours or ${totalMinutes} minutes or ${totalSeconds} seconds `; }
landing page by HAMZA