From 7b5ff098816ec5579b33394156a8646e65c28463 Mon Sep 17 00:00:00 2001 From: Tony Valle Date: Mon, 8 Apr 2024 13:23:39 +0200 Subject: [PATCH] fix: remove excessive converter calls --- .../helpers/deriveAutoGenerateEvents.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/core_modules/capture-core/components/Pages/New/RegistrationDataEntry/helpers/deriveAutoGenerateEvents.js b/src/core_modules/capture-core/components/Pages/New/RegistrationDataEntry/helpers/deriveAutoGenerateEvents.js index 401d02667b..6f9812734e 100644 --- a/src/core_modules/capture-core/components/Pages/New/RegistrationDataEntry/helpers/deriveAutoGenerateEvents.js +++ b/src/core_modules/capture-core/components/Pages/New/RegistrationDataEntry/helpers/deriveAutoGenerateEvents.js @@ -1,7 +1,6 @@ // @flow import moment from 'moment'; -import { dataElementTypes, ProgramStage } from '../../../../../metaData'; -import { convertClientToServer } from '../../../../../converters'; +import { ProgramStage } from '../../../../../metaData'; import { convertCategoryOptionsToServer } from '../../../../../converters/clientToServer'; const ignoreAutoGenerateIfApplicable = (stage, firstStageDuringRegistrationEvent) => @@ -53,13 +52,13 @@ export const deriveAutoGenerateEvents = ({ const eventInfo = openAfterEnrollment ? { status: 'ACTIVE', - occurredAt: convertClientToServer(dateToUseInActiveStatus, dataElementTypes.DATE), - scheduledAt: convertClientToServer(dateToUseInActiveStatus, dataElementTypes.DATE), + occurredAt: dateToUseInActiveStatus, + scheduledAt: dateToUseInActiveStatus, } : { status: 'SCHEDULE', // for schedule type of events we want to add the standard interval days to the date - scheduledAt: moment(convertClientToServer(dateToUseInScheduleStatus, dataElementTypes.DATE)) + scheduledAt: moment(dateToUseInScheduleStatus) .add(minDaysFromStart, 'days') .format('YYYY-MM-DD'), };