Fix date display (#410)
* fix homepage age * fix misspelling * remove log
This commit is contained in:
parent
c85e829c46
commit
4f986e9c2c
|
@ -82,14 +82,17 @@ export class PatientVitalsWidgetComponent extends DashboardWidgetComponent imple
|
|||
return
|
||||
}
|
||||
|
||||
//process Patient objecst
|
||||
//process Patient objects
|
||||
let sortedPatients = _.sortBy(queryResults?.[1], ['birthDate'])
|
||||
for(let patient of sortedPatients){
|
||||
if(!this.name && _.get(patient, 'name[0].family') && _.get(patient, 'name[0].given[0]')){
|
||||
this.name = `${_.get(patient, 'name[0].given[0]')} ${_.get(patient, 'name[0].family')}`
|
||||
}
|
||||
if(!this.age && _.get(patient, 'birthDate')){
|
||||
this.age = `${moment().diff(moment(_.get(patient, 'birthDate')), 'years')} years`
|
||||
const birthDate = _.get(patient, 'birthDate');
|
||||
if(!this.age && birthDate){
|
||||
const birthDateString = Array.isArray(birthDate) ? birthDate[0] : birthDate;
|
||||
const birthDateMoment = moment(birthDateString);
|
||||
this.age = `${moment().diff(birthDateMoment, 'years')} years`; // moment.diff rounds down
|
||||
}
|
||||
if(!this.gender && _.get(patient, 'gender[0]')){
|
||||
this.gender = _.get(patient, 'gender[0]')
|
||||
|
|
Loading…
Reference in New Issue