diff --git a/src/components/Dialogs/PeriodDimension/PeriodDimension.js b/src/components/Dialogs/PeriodDimension/PeriodDimension.js index e9146c22a..e741a6ac9 100644 --- a/src/components/Dialogs/PeriodDimension/PeriodDimension.js +++ b/src/components/Dialogs/PeriodDimension/PeriodDimension.js @@ -167,15 +167,6 @@ export const PeriodDimension = ({ dimension, onClose }) => { updatePeriodDimensionItems([]) } - const selectedPeriods = selectedIds.map((id) => ({ - id, - name: getNameFromMetadata(id), - })) - - const { dimensionId: selectedStartEndDate } = extractDimensionIdParts( - selectedIds[0] || '' - ) - return dimension ? ( {
{entryMethod === OPTION_PRESETS && ( ({ + id, + name: getNameFromMetadata(id), + }))} onSelect={({ items }) => updatePeriodDimensionItems(items) } @@ -209,7 +203,7 @@ export const PeriodDimension = ({ dimension, onClose }) => { )} {entryMethod === OPTION_START_END_DATES && ( { if (!value && selectedIds.length) { updatePeriodDimensionItems([]) diff --git a/src/components/Dialogs/PeriodDimension/StartEndDate.js b/src/components/Dialogs/PeriodDimension/StartEndDate.js index d786d99cf..320d4c97f 100644 --- a/src/components/Dialogs/PeriodDimension/StartEndDate.js +++ b/src/components/Dialogs/PeriodDimension/StartEndDate.js @@ -4,8 +4,10 @@ import PropTypes from 'prop-types' import React, { useEffect, useState } from 'react' import styles from './StartEndDate.module.css' -export const StartEndDate = ({ value, setValue }) => { - const [startDateStr, endDateStr] = value ? value.split('_') : [] +export const StartEndDate = ({ + value: [startDateStr, endDateStr], + setValue, +}) => { const [startDate, setStartDate] = useState(startDateStr) const [endDate, setEndDate] = useState(endDateStr) @@ -54,5 +56,5 @@ export const StartEndDate = ({ value, setValue }) => { } StartEndDate.propTypes = { setValue: PropTypes.func.isRequired, - value: PropTypes.string.isRequired, + value: PropTypes.array.isRequired, }