core.calculateagestring
Home > @medplum/core > calculateAgeString
calculateAgeString() function
Calculates the age string for display using the age appropriate units. If the age is greater than or equal to 2 years, then the age is displayed in years. If the age is greater than or equal to 1 month, then the age is displayed in months. Otherwise, the age is displayed in days.
Signature:
export declare function calculateAgeString(birthDateStr: string, endDateStr?: string): string | undefined;
Parameters
Parameter  | Type  | Description  | 
|---|---|---|
birthDateStr  | string  | The birth date or start date in ISO-8601 format YYYY-MM-DD.  | 
endDateStr  | string  | (Optional) Optional end date in ISO-8601 format YYYY-MM-DD. Default value is today.  | 
Returns:
string | undefined
The age string.