diff --git a/services/integration/invoiceIntegration.js b/services/integration/invoiceIntegration.js index e1f5a64..b2a49b0 100644 --- a/services/integration/invoiceIntegration.js +++ b/services/integration/invoiceIntegration.js @@ -228,9 +228,9 @@ const createNegativeFeeForDiscount = (memberData, dateRange) => { const { totalBookedHours, totalChargedHours, totalBookingChargedFee } = bookingData; const { memberId, officeId } = member; - let endDate = moment.utc().endOf('day').toISOString(); - if (dateRange.endDate){ - endDate = moment.utc(dateRange.endDate, DEFAULT_DATE_FORMAT).endOf('day').toISOString(); + let dateForDiscount = moment.utc().subtract(1, 'month').startOf('month').toISOString(); + if (dateRange.startDate){ + dateForDiscount = moment.utc(dateRange.startDate, DEFAULT_DATE_FORMAT).startOf('month').toISOString(); } let membershipFeeForDiscount = 0; @@ -269,7 +269,7 @@ const createNegativeFeeForDiscount = (memberData, dateRange) => { name: formattedName, price: -discount.toFixed(2), quantity: 1, - date: endDate, + date: dateForDiscount, member: memberId, team: null, office: officeId,