Skip to content

Commit

Permalink
refactor: format period boundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardo committed Nov 22, 2024
1 parent 6ab6411 commit 44b35fa
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/components/DataDimension/Info/ProgramIndicatorInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ export const ProgramIndicatorInfo = ({ id, displayNameProp }) => {
fetchData()
}, [fetchData])

const formatBoundaryTarget = (target) => {
if (
['ENROLLMENT_DATE', 'EVENT_DATE', 'INCIDENT_DATE'].includes(target)
) {
return sentenceCaseText(target)
}

return target
}

return (
<>
<InfoTable
Expand Down Expand Up @@ -100,7 +110,7 @@ export const ProgramIndicatorInfo = ({ id, displayNameProp }) => {
<li key={id}>
<span>
<span className="label">
{`${i18n.t('Type:')} `}
{i18n.t('Type:')}&nbsp;
</span>
{sentenceCaseText(
analyticsPeriodBoundaryType
Expand All @@ -111,7 +121,7 @@ export const ProgramIndicatorInfo = ({ id, displayNameProp }) => {
<span className="label">
{i18n.t('Target:')}&nbsp;
</span>
{sentenceCaseText(
{formatBoundaryTarget(
boundaryTarget
)}
</span>
Expand Down

0 comments on commit 44b35fa

Please sign in to comment.