-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
The current implementation of hquery/patientapi doesn't account for leap years. Consequently, a patient within about 16 days of their 65th birthday is 65 rather than 64 according to patient.age. The code should have 365.25 rather than 365 in the calculation of oneYear, as in the snippet below taken from https://github.com/scoophealth/patientapi/blob/scoop-develop/app/assets/javascripts/patient.js.coffee
*
@param (Date) date the date at which the patient age is calculated, defaults to now.
@returns {number} the patient age in years
age: (date = new Date()) ->
oneDay = 24_60_60_1000;
oneYear = 365.25_oneDay;
return (date.getTime()-this.birthtime().getTime())/oneYear;
Metadata
Metadata
Assignees
Labels
No labels