Skip to content

Commit

Permalink
correct txcurr asof
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrianbet committed Oct 21, 2024
1 parent cc53af3 commit 00f19f4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
10 changes: 10 additions & 0 deletions src/selectors/CT/CurrentOnArt/currentOnArtOverview.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,13 @@ export const getUnsuppressed = createSelector(
return list.Unsuppressed ? list.Unsuppressed : 0;
}
);


export const getTxDate = createSelector(
[listUnfiltered, listFiltered, filtered,],
(listUnfiltered, listFiltered, filtered) => {
const list = filtered ? listFiltered : listUnfiltered;

return list.EndofMonthDate;
}
)
12 changes: 3 additions & 9 deletions src/views/Home/HomeVLCascade.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,12 @@ import * as currentOnArtSelectors from '../../selectors/CT/CurrentOnArt/currentO
import { formatNumber, roundNumber } from '../../utils/utils';
import DataCard from '../Shared/DataCard';
import moment from 'moment';
import { getTxDate } from '../../selectors/CT/CurrentOnArt/currentOnArt';

const HomeVLCascade = () => {
const currentDate = moment();
const dateEOM = useSelector(currentOnArtOverviewSelectors.getTxDate);
const currentDate = moment(dateEOM);

// Check if the current date is before the 20th of the month
if (currentDate.date() < 19) {
// If true, subtract 2 months
currentDate.subtract(2, 'months');
} else {
// If false, subtract 1 month
currentDate.subtract(1, 'months');
}
// Format the date
const reporting_month = currentDate.format('MMM YYYY');

Expand Down

0 comments on commit 00f19f4

Please sign in to comment.