Skip to content

Commit

Permalink
fix(rhsmTransformers): sw-43 patch isFutureDate, isCurrentDate (#963)
Browse files Browse the repository at this point in the history
* rhsmTransformers, correctly apply date diff
  • Loading branch information
cdcabrera committed Aug 1, 2022
1 parent 5d4ee24 commit f4367a0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/services/rhsm/rhsmTransformers.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ const rhsmTally = response => {
const updatedResponse = {};
const { [rhsmConstants.RHSM_API_RESPONSE_DATA]: data = [], [rhsmConstants.RHSM_API_RESPONSE_META]: meta = {} } =
response || {};
const currentDate = moment.utc(dateHelpers.getCurrentDate()).format('MM-D-YYYY');
const currentDate = moment.utc(dateHelpers.getCurrentDate());
const currentDateStr = moment.utc(dateHelpers.getCurrentDate()).format('MM-D-YYYY');
let futureDateCount = 0;

updatedResponse.data = data.map(
Expand All @@ -76,10 +77,10 @@ const rhsmTally = response => {
index
) => {
const updatedDate = moment.utc(date);
const isCurrentDate = updatedDate.format('MM-D-YYYY') === currentDate;
const isCurrentDate = updatedDate.format('MM-D-YYYY') === currentDateStr;
const isFutureDate = updatedDate.diff(currentDate) > 0;

if (isFutureDate) {
if (isFutureDate && !isCurrentDate) {
futureDateCount += 1;
}

Expand Down

0 comments on commit f4367a0

Please sign in to comment.