diff --git a/src/components/PeriodDimension/utils/relativePeriods.js b/src/components/PeriodDimension/utils/relativePeriods.js index a0fb2463a..6789f2934 100644 --- a/src/components/PeriodDimension/utils/relativePeriods.js +++ b/src/components/PeriodDimension/utils/relativePeriods.js @@ -162,3 +162,12 @@ export const getRelativePeriodIds = () => Object.values(getOptions()) .map((option) => option.getPeriods().map((period) => period.id)) .flat() + +export const getRelativePeriodsMap = () => + Object.values(getOptions()) + .map((option) => option.getPeriods()) + .flat() + .reduce((acc, period) => { + acc[period.id] = period.name + return acc + }, {}) diff --git a/src/index.js b/src/index.js index 4518b2c1a..2484bfc11 100644 --- a/src/index.js +++ b/src/index.js @@ -338,7 +338,7 @@ export { } from './components/PeriodDimension/utils/index.js' export { getRelativePeriodsOptionsById, - getRelativePeriodIds, + getRelativePeriodsMap, } from './components/PeriodDimension/utils/relativePeriods.js' export { getFixedPeriodsOptionsById } from './components/PeriodDimension/utils/fixedPeriods.js'