Age Calculator — find out exactly how old you are
How old are you, exactly? Enter a birth date and get the age calculated instantly in years — handy for yourself, your kids, or keeping track of several birthdays at once. Unlike a throwaway calculator, this one keeps your data saved on your device: reopen the app anytime and every date you've entered is still there.
What it records
- Name or label (optional)
How it works
This is a Reactive app: a plain text document that your browser turns into a working app — forms, live data, tables, statistics and even charts, with nothing to install or configure.
- Use it right away. Hit “Use this app”: it opens right in your browser, ready to go, with data saved only on your device.
- Your data stays yours. Everything is stored locally on your device, kept separate for each app: no account, no server, nothing to set up.
- Make it your own. The text below is the entire app: copy it, tweak fields, views and words, and your changes become interactive instantly.
- Share it as a file. An app is a simple file: save it, export it or share it with a link; and with encrypted collaboration several people edit the same data in real time.
The app’s source
# 🎂 Age Calculator
How old are you, exactly? Enter a birth date and get the age calculated
instantly in years — handy for yourself, your kids, or keeping track of
several birthdays at once. Unlike a throwaway calculator, this one keeps
your data saved on your device: reopen the app anytime and every date you've
entered is still there.
::::form{path="people" id="fpe"}
::input{form="fpe" field="name" placeholder="Name or label (optional)"}
::input{form="fpe" field="birth" type="date" required="true" legend="Date of birth"}
::add-form{form="fpe" path="people" label="Calculate age"}
::::
:::python{data="people"}
```
from datetime import date
rows = data["people"]
today = date.today()
for r in rows:
birth = date.fromisoformat(r["birth"])
years = today.year - birth.year - ((today.month, today.day) < (birth.month, birth.day))
total_days = (today - birth).days
label = r["name"] if r["name"] else "Age"
print(f"{label}: {years} years ({total_days} days lived)")
```
:::
## History
:::table{path="people" headers="Name,Date of birth" deletable="true" editform="fpe"}
{name} | {birth}
:::
Add as many dates as you like: each person's age stays up to date, day after
day, every time you come back.