openchs-models 1.31.66 → 1.31.67
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
CHANGED
|
@@ -480,8 +480,12 @@ class Individual extends _BaseEntity.default {
|
|
|
480
480
|
return _Duration.default.inYear(0);
|
|
481
481
|
}
|
|
482
482
|
|
|
483
|
+
getTranslatedNameString(i18n) {
|
|
484
|
+
return this.isPerson() ? Individual.getFullName(this) : this.subjectType.type === _SubjectType.default.types.User ? `${this.firstName}(${i18n.t('you')})` : this.firstName;
|
|
485
|
+
}
|
|
486
|
+
|
|
483
487
|
get nameString() {
|
|
484
|
-
return this.isPerson() ? Individual.getFullName(this) : this.firstName;
|
|
488
|
+
return this.isPerson() ? Individual.getFullName(this) : this.subjectType.type === _SubjectType.default.types.User ? `${this.firstName}(You)` : this.firstName;
|
|
485
489
|
}
|
|
486
490
|
|
|
487
491
|
static getFullName(obj) {
|
|
@@ -235,7 +235,7 @@ class FormElement extends _BaseEntity.default {
|
|
|
235
235
|
}
|
|
236
236
|
} else if (this.concept.datatype === _Concept.default.dataType.Time && !(0, _moment.default)(value, 'HH:mm').isValid() && (!this.mandatory && !_lodash.default.isNil(value) || this.mandatory)) {
|
|
237
237
|
failure.messageKey = "invalidTimeFormat";
|
|
238
|
-
} else if (this.concept.datatype === _Concept.default.dataType.Date && !(0, _moment.default)(value).isValid() && (!this.mandatory && !_lodash.default.isNil(value) || this.mandatory)) {
|
|
238
|
+
} else if (this.concept.datatype === _Concept.default.dataType.Date && !(0, _moment.default)(value, 'YYYY-MM-DD').isValid() && (!this.mandatory && !_lodash.default.isNil(value) || this.mandatory)) {
|
|
239
239
|
failure.messageKey = "invalidDateFormat";
|
|
240
240
|
} else if (this.mandatory && this.concept.datatype === _Concept.default.dataType.Duration && _lodash.default.some(_lodash.default.map(value.durations, "durationValue"), durationValue => _lodash.default.isEmpty(durationValue))) {
|
|
241
241
|
failure.messageKey = "emptyValidationMessage";
|