Skip to content

Commit

Permalink
[MDCT-2526] Update Filter on home page to use the year from state (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
BearHanded authored Aug 29, 2023
1 parent ca1a854 commit 71225b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ const mapState = (state) => ({
}),
currentUserRole: state.stateUser.currentUser.role,
reportstate: state.reportStatus,
yearList: selectYears(),
yearList: selectYears(state),
});

const mapDispatch = {
Expand Down
6 changes: 4 additions & 2 deletions services/ui-src/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,13 @@ export const { selectFormStatus, selectFormStatuses } = (() => {
};
})();

export const selectYears = () => {
export const selectYears = (state) => {
const { global } = state;

let yearArray = [];
for (
let x = 2020;
x <= 2022;
x <= global.currentYear;
x++ // 2020 is the first year the new CARTS was used so there won't be an < 2020 forms
) {
yearArray.push({ label: x, value: x });
Expand Down

0 comments on commit 71225b4

Please sign in to comment.