Age calculation for developers

ChronoCalc does not host a REST API. There is no /api/calculate endpoint, no API key, and no server that accepts a date of birth. The live site is static. Every calculator runs in the visitor’s browser so birth dates are not uploaded. If you need the math inside your own app, implement it locally. Do not fetch chronocalc.org and expect JSON.

Borrowing method

Subtract the birth date from the target date in three fields. If the day difference is negative, add the length of the previous month (28, 29, 30, or 31) and subtract one month. If the month difference is then negative, add 12 and subtract one year. That result is chronological age in years, months, and days. It matches the steps on how to calculate chronological age and the notes on methodology.

Parse YYYY-MM-DD as a civil date in the local calendar. Constructing a JavaScript Date from that string with the UTC parser can shift the day for time zones behind UTC. Build the date from numeric year, month, and day instead.

Completed months are years × 12 + months after borrowing. Do not multiply the year age by 12 and ignore leftover months. Total days are the count of calendar days between the two dates, including February 29 when it falls in the span. Weeks are that day count divided by 7. A decimal week is not a rounded week unless you say you rounded.

Worked check

Birth date 15 March 2010, target date 3 June 2026. Days: 3 − 15 is negative, so borrow May’s 31 days: 3 + 31 − 15 = 19 days, and the month gap loses one. Months: June minus March is 3, minus the borrowed month, equals 2. Years: 2026 − 2010 = 16. The age is 16 years, 2 months, 19 days. The same triple is used as an example on what chronological age means. Recompute it in your function before you trust a port.

Corrected age and PMA, still local

Weeks born early are commonly estimated as 40 minus gestational age at birth in weeks, when that is the definition your chart uses. Corrected age subtracts those weeks from chronological age. Post-menstrual age adds chronological weeks to gestational age at birth. Those are different results. This website calculates them in the browser on the corrected age calculator and the gestational age calculator. There is no JSON endpoint for either one. Confirm the 40-week term assumption against the record you have; some charts already store “weeks early” and should not be subtracted twice.

Nearest-month rounding

Some cognitive batteries round days of 16 or more up to the next month and then drop the day field. That step happens after the exact age exists. Keep the exact triple in your data model and format a second string for the record form. Writing only the rounded month makes the original day span unrecoverable. Publisher-specific notes are on the methodology page. ChronoCalc is not those publishers’ software.

If you wanted a hosted endpoint

We are not offering one. A hosted age API would receive dates of birth, which this site is built to avoid. Implement the borrowing method in your own process, under your own privacy review. Questions about a discrepancy in the public calculators go to [email protected] or the contact page. Please include the two dates and the result you expected. Do not include a patient’s name.

You can link to chronocalc.org so a person can check a figure by hand. There is no rate limit to publish, because the site does not accept calculation requests. If your port of the March 15, 2010 to June 3, 2026 example does not return 16 years, 2 months, and 19 days, the borrow or the date parser is wrong. Fix that before you trust longer spans.