openchs-models 1.30.21 → 1.30.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Individual.js +9 -0
- package/package.json +1 -1
package/dist/Individual.js
CHANGED
|
@@ -412,6 +412,15 @@ class Individual extends _BaseEntity.default {
|
|
|
412
412
|
return ageInWeeks === 0 ? _Duration.default.inDay((0, _moment.default)().diff(this.dateOfBirth, "days")).toString(i18n) : _Duration.default.inWeek(ageInWeeks).toString(i18n);
|
|
413
413
|
} else if (ageInYears < 2) {
|
|
414
414
|
return _Duration.default.inMonth((0, _moment.default)().diff(this.dateOfBirth, "months")).toString(i18n);
|
|
415
|
+
} else if (ageInYears < 6) {
|
|
416
|
+
let ageInMonths = (0, _moment.default)().diff(this.dateOfBirth, "months");
|
|
417
|
+
|
|
418
|
+
let noOfYears = _lodash.default.toInteger(ageInMonths / 12);
|
|
419
|
+
|
|
420
|
+
let noOfMonths = ageInMonths % 12;
|
|
421
|
+
let durationInYears = `${_Duration.default.inYear(noOfYears).toString(i18n)}`;
|
|
422
|
+
if (noOfMonths > 0) return `${durationInYears} ${_Duration.default.inMonth(noOfMonths).toString(i18n)}`;
|
|
423
|
+
return durationInYears;
|
|
415
424
|
} else {
|
|
416
425
|
return _Duration.default.inYear(ageInYears).toString(i18n);
|
|
417
426
|
}
|