Skip to content

Commit

Permalink
fix: use period name in invalid period warning
Browse files Browse the repository at this point in the history
  • Loading branch information
tomzemp committed Sep 27, 2024
1 parent 43492f7 commit 968311e
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,18 @@ export const PeriodSelectorBarItem = () => {
])

useEffect(() => {
const resetPeriod = (id) => {
showWarningAlert(`The Period (${id}) is not open or is invalid.`)
i18n.t('The Period ({{id}}) is not open or is invalid.', {
id,
})
const resetPeriod = (id, displayName) => {
showWarningAlert(
i18n.t('The Period ({{id}}) is not open or is invalid.', {
id: displayName ? displayName : id,
})
)
setPeriodId(undefined)
}

if (selectedPeriod) {
const endDate = selectedPeriod?.endDate
const displayName = selectedPeriod?.displayName

// date comparison
if (
Expand All @@ -127,11 +129,11 @@ export const PeriodSelectorBarItem = () => {
calendar,
})
) {
resetPeriod(periodId)
resetPeriod(periodId, displayName)
}

if (selectedPeriod?.periodType !== dataSetPeriodType) {
resetPeriod(periodId)
resetPeriod(periodId, selectedPeriod?.displayName)
}
} else if (periodId) {
setPeriodId(undefined)
Expand Down

0 comments on commit 968311e

Please sign in to comment.