O3 Framework / age
age(
birthDate,currentDate):null|string
Defined in: packages/framework/esm-utils/src/age-helpers.ts:83
Gets a human readable and locale supported representation of a person’s age, given their birthDate, The representation logic follows the guideline here: https://webarchive.nationalarchives.gov.uk/ukgwa/20160921162509mp_/http://systems.digital.nhs.uk/data/cui/uig/patben.pdf (See Tables 7 and 8)
ConfigType
The birthDate. If birthDate is null, returns null.
ConfigType = ...
Optional. If provided, calculates the age of the person at the provided currentDate (instead of now).
null | string
A human-readable string version of the age.
age('2020-02-29', '2024-07-30') // => '4 yrs, 5 mths'
// String dates with partial precision are supported
age('2000', '2024-07-30') // => '24 yrs'