From 884b8a4998589fd90682db2430ad84c36c05b02d Mon Sep 17 00:00:00 2001 From: Vineet Sharma Date: Tue, 9 Apr 2024 17:49:08 +0530 Subject: [PATCH] (fix) O3-3001: Form engine shouldn't send encounterDatetime when saving a new form (#131) --- .../src/form-entry/value-adapters/encounter.adapter.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/ngx-formentry/src/form-entry/value-adapters/encounter.adapter.ts b/projects/ngx-formentry/src/form-entry/value-adapters/encounter.adapter.ts index a328486a..613101ad 100644 --- a/projects/ngx-formentry/src/form-entry/value-adapters/encounter.adapter.ts +++ b/projects/ngx-formentry/src/form-entry/value-adapters/encounter.adapter.ts @@ -155,7 +155,7 @@ export class EncounterAdapter implements ValueAdapter { if (!payload.encounterDatetime) { this.setPayloadEncounterDate( payload, - form.valueProcessingInfo.encounterDatetime ?? new Date().toISOString(), + form.valueProcessingInfo.encounterDatetime, form.valueProcessingInfo.utcOffset ); } @@ -189,6 +189,10 @@ export class EncounterAdapter implements ValueAdapter { encounterDatetime: string, utcOffset: string ) { + if (!encounterDatetime) { + // Not sending encounter datetime from the UI if no encounter datetime is specified + return; + } const dateValue = moment(encounterDatetime).utcOffset(utcOffset || '+0300'); payload['encounterDatetime'] = dateValue.format(); }