Discounts are now at the beginning of a month
This commit is contained in:
@@ -228,9 +228,9 @@ const createNegativeFeeForDiscount = (memberData, dateRange) => {
|
|||||||
const { totalBookedHours, totalChargedHours, totalBookingChargedFee } = bookingData;
|
const { totalBookedHours, totalChargedHours, totalBookingChargedFee } = bookingData;
|
||||||
const { memberId, officeId } = member;
|
const { memberId, officeId } = member;
|
||||||
|
|
||||||
let endDate = moment.utc().endOf('day').toISOString();
|
let dateForDiscount = moment.utc().subtract(1, 'month').startOf('month').toISOString();
|
||||||
if (dateRange.endDate){
|
if (dateRange.startDate){
|
||||||
endDate = moment.utc(dateRange.endDate, DEFAULT_DATE_FORMAT).endOf('day').toISOString();
|
dateForDiscount = moment.utc(dateRange.startDate, DEFAULT_DATE_FORMAT).startOf('month').toISOString();
|
||||||
}
|
}
|
||||||
|
|
||||||
let membershipFeeForDiscount = 0;
|
let membershipFeeForDiscount = 0;
|
||||||
@@ -269,7 +269,7 @@ const createNegativeFeeForDiscount = (memberData, dateRange) => {
|
|||||||
name: formattedName,
|
name: formattedName,
|
||||||
price: -discount.toFixed(2),
|
price: -discount.toFixed(2),
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
date: endDate,
|
date: dateForDiscount,
|
||||||
member: memberId,
|
member: memberId,
|
||||||
team: null,
|
team: null,
|
||||||
office: officeId,
|
office: officeId,
|
||||||
|
|||||||
Reference in New Issue
Block a user