Age Calculation for Legal Requirements

May 28, 20265 min read

When Exact Age Matters

Most of the time, knowing you are "about 30" is fine. But legal systems require precise age calculation. A single day determines whether someone can sign a contract, buy alcohol, or collect retirement benefits. Getting it wrong has real consequences: lawsuits, regulatory fines, or denied benefits.

In nearly all jurisdictions, you reach an age on your birthday — not the day before. You become 18 at the start of the day you were born 18 years ago.

Legal age reached on: Birth date + N years

Someone born on June 15, 2008, turns 18 on June 15, 2026. On June 14, 2026, they are still 17.

The Leap Year Edge Case

What about someone born on February 29? Most legal systems use February 28 as the age-reached date in non-leap years:

Birth Date18th Birthday (Non-Leap)18th Birthday (Leap)
Feb 28, 2008Feb 28, 2026Feb 28, 2026
Feb 29, 2008Feb 28, 2026Feb 29, 2028

Some jurisdictions (including the UK) explicitly define February 28 as the legal birthday for leap-day births in common years. Always check local law.

Age of Majority by Jurisdiction

The age at which a person gains full legal capacity varies:

RegionAge of MajorityNotes
United States18 (most states)Alabama and Nebraska: 19; Mississippi: 21
United Kingdom18Scotland: 16 for some purposes
Canada18 (most provinces)BC, NS, NB, NL, NWT, Yukon: 19
Australia18All states and territories
Japan18Lowered from 20 in 2022
Germany18Full capacity; limited at 16

Regulatory Age Requirements

Different ages apply depending on the regulated activity:

United States

ActivityMinimum AgeGoverning Law
Voting1826th Amendment
Alcohol purchase21National Minimum Drinking Age Act
Tobacco purchase21T21 (2019)
Federal employment18Varies by position
Driver's license16–18State-dependent
Military enlistment17 (with consent)10 USC §505
Social Security (early)62SSA rules
Medicare65SSA rules

European Union

ActivityTypical Minimum AgeVariation
Voting16–18Austria: 16; most: 18
Alcohol (beer/wine)16–18Germany: 16; UK: 18
Alcohol (spirits)18EU-wide minimum
Driving17–18Varies by country
Employment (full-time)15–16EU Directive 94/33/EC

Age Verification in Software

Applications that enforce age restrictions must calculate age accurately:

Correct Calculation

function calculateAge(birthDate, referenceDate = new Date()) {
  let age = referenceDate.getFullYear() - birthDate.getFullYear();
  const monthDiff = referenceDate.getMonth() - birthDate.getMonth();

  if (monthDiff < 0 || (monthDiff === 0 && referenceDate.getDate() < birthDate.getDate())) {
    age--;
  }

  return age;
}

Common Bug: Year-Only Subtraction

// WRONG — fails for people who haven't had their birthday yet this year
const age = referenceDate.getFullYear() - birthDate.getFullYear();

On March 1, 2026, someone born July 15, 2008, is 17 — not 18. Year-only subtraction gives 18, incorrectly passing age checks.

Another Bug: Time Zone Mismatch

If the server is in UTC and the user is in PST, a birth date of January 1 might be stored as December 31 UTC. The age calculation runs against the wrong date.

Fix: Always compute age against the user's local date, not the server's UTC date.

Age in Completed Years vs. Age at Next Birthday

Legal systems sometimes ask different questions:

QuestionMeaningExample (born July 15, 2008)
Age in completed yearsHow many full years have passed?17 (as of March 1, 2026)
Age at next birthdayHow old will you turn next?18

Life insurance applications and some government forms ask for "age at next birthday" rather than completed years. Confusing the two leads to incorrect premium calculations or ineligible claims.

Key Takeaways

  • Legal age is reached on the birthday, not the day before — a one-day error can cause regulatory violations
  • Leap-day births (February 29) reach legal age on February 28 in common years in most jurisdictions
  • Year-only subtraction is the most common age calculation bug — always check month and day
  • Time zone differences between server and user can shift the birth date by a day
  • Different activities have different legal age thresholds — verify the specific requirement for each use case
  • "Age in completed years" and "age at next birthday" are different values — use whichever the form or regulation specifies

Try It Yourself

Calculate exact age in years, months, and days with our Age Calculator. Enter a birth date and reference date to see precise results — no manual math required.