From d4800d735ebefe42e45feccad4f572ab9a38f04d Mon Sep 17 00:00:00 2001 From: Mozafar Haider Date: Tue, 5 Mar 2024 12:23:25 +0000 Subject: [PATCH] fix(migration-events): change start and endDate to occuuredBefore and occuredAfter --- src/components/Inputs/EndDate.js | 12 +++++++++--- src/components/Inputs/StartDate.js | 12 +++++++++--- src/pages/EventExport/EventExport.js | 8 ++++---- src/pages/EventExport/form-helper.js | 8 ++++---- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/components/Inputs/EndDate.js b/src/components/Inputs/EndDate.js index 164f3b097..18b488a88 100644 --- a/src/components/Inputs/EndDate.js +++ b/src/components/Inputs/EndDate.js @@ -1,5 +1,6 @@ import i18n from '@dhis2/d2-i18n' import { hasValue, composeValidators } from '@dhis2/ui' +import PropTypes from 'prop-types' import React from 'react' import { DATE_VALIDATOR } from '../DatePicker/DatePickerField.js' import { DatePickerField } from '../index.js' @@ -9,13 +10,18 @@ const DATATEST = 'input-end-date' const LABEL = i18n.t('End date') const VALIDATOR = composeValidators(hasValue, DATE_VALIDATOR) -const EndDate = () => ( +const EndDate = ({name, label}) => ( ) +EndDate.propTypes = { + label: PropTypes.string, + name: PropTypes.string +} + export { EndDate } diff --git a/src/components/Inputs/StartDate.js b/src/components/Inputs/StartDate.js index 8b77968f8..1499a1d7a 100644 --- a/src/components/Inputs/StartDate.js +++ b/src/components/Inputs/StartDate.js @@ -1,21 +1,27 @@ import i18n from '@dhis2/d2-i18n' import { hasValue, composeValidators } from '@dhis2/ui' +import PropTypes from 'prop-types' import React from 'react' import { DATE_VALIDATOR } from '../DatePicker/DatePickerField.js' import { DatePickerField } from '../index.js' + const NAME = 'startDate' const DATATEST = 'input-start-date' const LABEL = i18n.t('Start date') const VALIDATOR = composeValidators(hasValue, DATE_VALIDATOR) -const StartDate = () => ( +const StartDate = ({name, label}) => ( ) +StartDate.propTypes = { + label: PropTypes.string, + name: PropTypes.string +} export { StartDate } diff --git a/src/pages/EventExport/EventExport.js b/src/pages/EventExport/EventExport.js index 4565c7ee3..e7cc15db7 100644 --- a/src/pages/EventExport/EventExport.js +++ b/src/pages/EventExport/EventExport.js @@ -58,8 +58,8 @@ const initialValues = { programStage: undefined, format: defaultFormatOption, compression: defaultCompressionOption, - startDate: jsDateToISO8601(threeMonthsBeforeToday), - endDate: jsDateToISO8601(today), + occurredAfter: jsDateToISO8601(threeMonthsBeforeToday), + occurredBefore: jsDateToISO8601(today), includeDeleted: false, dataElementIdScheme: defaultDataElementIdSchemeOption, orgUnitIdScheme: defaultOrgUnitIdSchemeOption, @@ -101,8 +101,8 @@ const EventExport = () => { - - + + diff --git a/src/pages/EventExport/form-helper.js b/src/pages/EventExport/form-helper.js index 82c200e55..898d104c4 100644 --- a/src/pages/EventExport/form-helper.js +++ b/src/pages/EventExport/form-helper.js @@ -14,8 +14,8 @@ const onExport = (baseUrl, setExportEnabled) => (values) => { programStage, format, compression, - startDate, - endDate, + occurredAfter, + occurredBefore, includeDeleted, dataElementIdScheme, orgUnitIdScheme, @@ -38,8 +38,8 @@ const onExport = (baseUrl, setExportEnabled) => (values) => { `orgUnitIdScheme=${orgUnitIdScheme}`, `idScheme=${idScheme}`, `attachment=${filename}`, - `startDate=${startDate}`, - `endDate=${endDate}`, + `occurredAfter=${occurredAfter}`, + `occurredBefore=${occurredBefore}`, `ouMode=${inclusion}`, `format=${format}`, programStage != ALL_VALUE ? `programStage=${programStage}` : '',