const { useState, useEffect, useRef } = React; // Utility Functions const calculateAge = (birthDate, targetDate = new Date()) => { const birth = new Date(birthDate); const target = new Date(targetDate); let years = target.getFullYear() - birth.getFullYear(); let months = target.getMonth() - birth.getMonth(); let days = target.getDate() - birth.getDate(); if (days < 0) { months--; const prevMonth = new Date(target.getFullYear(), target.getMonth(), 0); days += prevMonth.getDate(); } if (months < 0) { years--; months += 12; } const diffMs = target - birth; const totalDays = Math.floor(diffMs / (1000 * 60 * 60 * 24)); const totalWeeks = Math.floor(totalDays / 7); const totalHours = Math.floor(diffMs / (1000 * 60 * 60)); const totalMinutes = Math.floor(diffMs / (1000 * 60)); const totalSeconds = Math.floor(diffMs / 1000); return { years, months, days, totalDays, totalWeeks, totalHours, totalMinutes, totalSeconds }; }; const getDayOfWeek = (dateStr) => { const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; const meanings = [ 'Fair of face', 'Full of grace', 'Full of woe', 'Has far to go', 'Loving and giving', 'Works hard for a living', 'Bonny, blithe, good and gay' ]; const date = new Date(dateStr); const dayIndex = date.getDay(); return { day: days[dayIndex], meaning: meanings[dayIndex] }; }; const getZodiacInfo = (dateStr) => { const date = new Date(dateStr); const month = date.getMonth() + 1; const day = date.getDate(); const zodiacSigns = [ { sign: 'Capricorn', start: [12, 22], end: [1, 19], traits: 'Ambitious, disciplined, patient', element: 'Earth' }, { sign: 'Aquarius', start: [1, 20], end: [2, 18], traits: 'Independent, humanitarian, inventive', element: 'Air' }, { sign: 'Pisces', start: [2, 19], end: [3, 20], traits: 'Compassionate, artistic, intuitive', element: 'Water' }, { sign: 'Aries', start: [3, 21], end: [4, 19], traits: 'Courageous, energetic, confident', element: 'Fire' }, { sign: 'Taurus', start: [4, 20], end: [5, 20], traits: 'Reliable, patient, practical', element: 'Earth' }, { sign: 'Gemini', start: [5, 21], end: [6, 20], traits: 'Adaptable, curious, witty', element: 'Air' }, { sign: 'Cancer', start: [6, 21], end: [7, 22], traits: 'Nurturing, protective, intuitive', element: 'Water' }, { sign: 'Leo', start: [7, 23], end: [8, 22], traits: 'Creative, generous, warm-hearted', element: 'Fire' }, { sign: 'Virgo', start: [8, 23], end: [9, 22], traits: 'Analytical, practical, diligent', element: 'Earth' }, { sign: 'Libra', start: [9, 23], end: [10, 22], traits: 'Diplomatic, fair-minded, social', element: 'Air' }, { sign: 'Scorpio', start: [10, 23], end: [11, 21], traits: 'Passionate, resourceful, brave', element: 'Water' }, { sign: 'Sagittarius', start: [11, 22], end: [12, 21], traits: 'Optimistic, adventurous, honest', element: 'Fire' } ]; const birthstones = ['Garnet', 'Amethyst', 'Aquamarine', 'Diamond', 'Emerald', 'Pearl', 'Ruby', 'Peridot', 'Sapphire', 'Opal', 'Topaz', 'Turquoise']; const flowers = ['Carnation', 'Violet', 'Daffodil', 'Daisy', 'Lily of the Valley', 'Rose', 'Larkspur', 'Gladiolus', 'Aster', 'Marigold', 'Chrysanthemum', 'Poinsettia']; let zodiac = zodiacSigns[0]; for (const z of zodiacSigns) { const [sm, sd] = z.start; const [em, ed] = z.end; if ((month === sm && day >= sd) || (month === em && day <= ed)) { zodiac = z; break; } } return { ...zodiac, birthstone: birthstones[date.getMonth()], flower: flowers[date.getMonth()] }; }; const getHalfBirthday = (dateStr) => { const date = new Date(dateStr); const halfBirthday = new Date(date); halfBirthday.setMonth(halfBirthday.getMonth() + 6); return halfBirthday; }; const getNextBirthday = (dateStr) => { const birth = new Date(dateStr); const today = new Date(); const nextBirthday = new Date(today.getFullYear(), birth.getMonth(), birth.getDate()); if (nextBirthday < today) { nextBirthday.setFullYear(nextBirthday.getFullYear() + 1); } return nextBirthday; }; // Mock Fun Facts Data const getFunFacts = (dateStr) => { const date = new Date(dateStr); const month = date.getMonth(); const day = date.getDate(); const year = date.getFullYear(); const famousPeople = [ ['Muhammad Ali', 'Isaac Newton', 'J.R.R. Tolkien'], ['Bob Marley', 'Charles Darwin', 'Abraham Lincoln'], ['Albert Einstein', 'Dr. Seuss', 'Alexander Graham Bell'], ['Leonardo da Vinci', 'Charlie Chaplin', 'Thomas Jefferson'], ['John F. Kennedy', 'Queen Victoria', 'Audrey Hepburn'], ['Marilyn Monroe', 'Anne Frank', 'Che Guevara'], ['Nelson Mandela', 'Princess Diana', 'Frida Kahlo'], ['Barack Obama', 'Neil Armstrong', 'Napoleon Bonaparte'], ['Beyoncรฉ', 'Stephen King', 'Michael Jackson'], ['John Lennon', 'Mahatma Gandhi', 'Bill Gates'], ['Marie Curie', 'Leonardo DiCaprio', 'Martin Luther'], ['Taylor Swift', 'Frank Sinatra', 'Walt Disney'] ]; const events = [ 'The first email was sent', 'The Moon landing occurred', 'The Berlin Wall fell', 'The first iPhone was released', 'World Wide Web went public' ]; return { famousPeople: famousPeople[month], historicalEvent: events[day % events.length], numberOneSong: `#1 Hit of ${year}`, topMovie: `Blockbuster of ${year}`, statistic: `Only 0.27% of people share your exact birthday!` }; }; // Components const Navigation = ({ activeSection }) => { const sections = [ { id: 'age-calculator', label: 'Age Calculator' }, { id: 'future-age', label: 'Future Age' }, { id: 'day-born', label: 'Day Born' }, { id: 'days-alive', label: 'Days Alive' }, { id: 'half-birthday', label: 'Half Birthday' }, { id: 'zodiac', label: 'Zodiac' }, { id: 'countdown', label: 'Countdown' }, { id: 'fun-facts', label: 'Fun Facts' } ]; return ( ); }; const Hero = () => (

Discover Everything About Your Birthday

Free birthday calculator tools to find your exact age, zodiac sign, birthstone, famous birthday twins, and more โ€“ all in one place.

Calculate My Age Now
); const SectionCard = ({ id, icon, title, children }) => (
{icon}

{title}

{children}
); const DateInput = ({ label, value, onChange, id }) => (
onChange(e.target.value)} className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-transparent" />
); const Button = ({ onClick, children, variant = 'primary' }) => ( ); const ResultBox = ({ label, value, icon }) => (
{icon && {icon}}
{value}
{label}
); const ShareButtons = ({ text, onShare }) => { const platforms = [ { name: 'Twitter', icon: '๐•', color: 'bg-black' }, { name: 'Facebook', icon: 'f', color: 'bg-blue-600' }, { name: 'WhatsApp', icon: '๐Ÿ“ฑ', color: 'bg-green-500' }, { name: 'Copy', icon: '๐Ÿ“‹', color: 'bg-gray-600' } ]; return (
Share: {platforms.map(p => ( ))}
); }; // Main Calculator Components const AgeCalculator = () => { const [birthDate, setBirthDate] = useState(''); const [result, setResult] = useState(null); const calculate = () => { if (birthDate) { setResult(calculateAge(birthDate)); } }; return (

Calculate your exact age down to the second. Enter your birth date and instantly see how old you are in years, months, weeks, days, hours, minutes, and seconds.

{result && (
)}
); }; const FutureAgeCalculator = () => { const [birthDate, setBirthDate] = useState(''); const [futureDate, setFutureDate] = useState(''); const [result, setResult] = useState(null); const calculate = () => { if (birthDate && futureDate) { setResult(calculateAge(birthDate, futureDate)); } }; return (

Wondering how old you'll be on a specific date? Enter your birth date and any future date to instantly see your age at that moment.

{result && (
)}
); }; const DayBornFinder = () => { const [birthDate, setBirthDate] = useState(''); const [result, setResult] = useState(null); const calculate = () => { if (birthDate) { setResult(getDayOfWeek(birthDate)); } }; return (

Find out if you're a Monday's child or a Friday baby with our instant day finder. Discover the exact weekday of your birth plus the famous nursery rhyme meaning.

{result && (
{result.day}
"{result.day}'s child is {result.meaning.toLowerCase()}"
)}
); }; const DaysAliveCalculator = () => { const [birthDate, setBirthDate] = useState(''); const [result, setResult] = useState(null); const calculate = () => { if (birthDate) { const age = calculateAge(birthDate); const milestones = [10000, 15000, 20000, 25000, 30000]; const nextMilestone = milestones.find(m => m > age.totalDays) || milestones[milestones.length - 1]; const daysToMilestone = nextMilestone - age.totalDays; setResult({ ...age, nextMilestone, daysToMilestone }); } }; return (

How many days old are you? Find the exact number of days you've been alive and discover upcoming milestones like your 10,000th or 20,000th day!

{result && (
)}
); }; const HalfBirthdayFinder = () => { const [birthDate, setBirthDate] = useState(''); const [result, setResult] = useState(null); const calculate = () => { if (birthDate) { const halfBday = getHalfBirthday(birthDate); const today = new Date(); let nextHalf = new Date(today.getFullYear(), halfBday.getMonth(), halfBday.getDate()); if (nextHalf < today) nextHalf.setFullYear(nextHalf.getFullYear() + 1); const daysUntil = Math.ceil((nextHalf - today) / (1000 * 60 * 60 * 24)); setResult({ date: halfBday.toLocaleDateString('en-US', { month: 'long', day: 'numeric' }), daysUntil }); } }; return (

Find your half-birthday! A half-birthday falls exactly 6 months after your actual birthday โ€“ a fun excuse for an extra celebration.

{result && (
)}
); }; const ZodiacFinder = () => { const [birthDate, setBirthDate] = useState(''); const [result, setResult] = useState(null); const calculate = () => { if (birthDate) { setResult(getZodiacInfo(birthDate)); } }; const zodiacEmojis = { Aries: 'โ™ˆ', Taurus: 'โ™‰', Gemini: 'โ™Š', Cancer: 'โ™‹', Leo: 'โ™Œ', Virgo: 'โ™', Libra: 'โ™Ž', Scorpio: 'โ™', Sagittarius: 'โ™', Capricorn: 'โ™‘', Aquarius: 'โ™’', Pisces: 'โ™“' }; return (

Discover your zodiac sign, birthstone, and birth flower based on your birthday. Learn your astrological traits and symbolic gems.

{result && (
{zodiacEmojis[result.sign]}
{result.sign}
{result.element} Sign
{result.traits}
๐Ÿ’Ž
{result.birthstone}
Your Birthstone
๐ŸŒธ
{result.flower}
Your Birth Flower
)}
); }; const BirthdayCountdown = () => { const [birthDate, setBirthDate] = useState(''); const [countdown, setCountdown] = useState(null); const [isRunning, setIsRunning] = useState(false); useEffect(() => { if (!isRunning || !birthDate) return; const timer = setInterval(() => { const nextBday = getNextBirthday(birthDate); const now = new Date(); const diff = nextBday - now; const days = Math.floor(diff / (1000 * 60 * 60 * 24)); const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60)); const seconds = Math.floor((diff % (1000 * 60)) / 1000); const birth = new Date(birthDate); const turningAge = nextBday.getFullYear() - birth.getFullYear(); setCountdown({ days, hours, minutes, seconds, turningAge, nextDate: nextBday.toLocaleDateString() }); }, 1000); return () => clearInterval(timer); }, [isRunning, birthDate]); const startCountdown = () => { if (birthDate) setIsRunning(true); }; return (

How long until your next birthday? Start a live countdown and watch the days, hours, minutes, and seconds tick down to your special day!

{countdown && (
Counting down to {countdown.nextDate} when you turn {countdown.turningAge}
{countdown.days}
Days
{countdown.hours}
Hours
{countdown.minutes}
Minutes
{countdown.seconds}
Seconds
)}
); }; const BirthdayFunFacts = () => { const [birthDate, setBirthDate] = useState(''); const [name, setName] = useState(''); const [result, setResult] = useState(null); const [loading, setLoading] = useState(false); const [copied, setCopied] = useState(false); const generate = () => { if (birthDate) { setLoading(true); // Simulate API call delay setTimeout(() => { setResult(getFunFacts(birthDate)); setLoading(false); }, 1500); } }; const handleShare = (platform, text) => { const shareText = `๐ŸŽ‚ I discovered my birthday fun facts on BirthdayHub.net! I share my birthday with ${result?.famousPeople[0]}! Check yours:`; const url = 'https://birthdayhub.net'; const urls = { Twitter: `https://twitter.com/intent/tweet?text=${encodeURIComponent(shareText)}&url=${encodeURIComponent(url)}`, Facebook: `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(url)}"e=${encodeURIComponent(shareText)}`, WhatsApp: `https://wa.me/?text=${encodeURIComponent(shareText + ' ' + url)}`, Copy: null }; if (platform === 'Copy') { navigator.clipboard?.writeText(shareText + ' ' + url); setCopied(true); setTimeout(() => setCopied(false), 2000); } else if (urls[platform]) { window.open(urls[platform], '_blank', 'width=600,height=400'); } }; return (

Uncover fascinating AI-powered facts about your birthday! See which celebrities share your birth date, major world events, and personalized fun statistics.

setName(e.target.value)} placeholder="Enter your name for personalized results" className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-transparent" />
{result && }
{loading && (

Generating your birthday facts...

)} {result && !loading && (

๐ŸŒŸ Famous People Born This Day

{result.famousPeople.map((person, i) => ( {person} ))}

๐Ÿ“œ Historical Event

{result.historicalEvent}

๐ŸŽต Music & Movies

{result.numberOneSong}

๐Ÿ“Š Fun Statistic

{result.statistic}

{copied && โœ“ Copied to clipboard!}
)}
); }; const FAQ = () => { const [openIndex, setOpenIndex] = useState(null); const faqs = [ { q: 'How do I calculate my exact age?', a: 'Enter your birth date in our Birthday & Age Calculator above. It instantly calculates your age in years, months, weeks, days, hours, minutes, and seconds.' }, { q: 'What day of the week was I born on?', a: "Use our 'What Day Was I Born' tool โ€“ just enter your birth date and we'll show you the exact weekday along with its traditional nursery rhyme meaning." }, { q: 'How many days have I been alive?', a: 'Our Age in Days Calculator shows exactly how many days you\'ve lived since birth, plus highlights upcoming milestones like your 10,000th day alive.' }, { q: 'When is my half-birthday?', a: 'Your half-birthday is exactly 6 months after your birthday. Enter your birth date in our Half-Birthday Finder to see the exact date.' }, { q: 'Are these birthday calculators free?', a: 'Yes! All tools on BirthdayHub.net are 100% free with no signup required.' } ]; return (

โ“ Frequently Asked Questions

{faqs.map((faq, i) => (
{openIndex === i && (
{faq.a}
)}
))}
); }; const Footer = () => ( ); function App() { const [activeSection, setActiveSection] = useState('age-calculator'); useEffect(() => { const observer = new IntersectionObserver( (entries) => { entries.forEach(entry => { if (entry.isIntersecting) { setActiveSection(entry.target.id); } }); }, { threshold: 0.3 } ); document.querySelectorAll('section[id]').forEach(section => { observer.observe(section); }); return () => observer.disconnect(); }, []); return (
); }