stripe webhook for unpaid subs: add 3 days of remaining time

This commit is contained in:
Matteo Pagliazzi
2017-03-28 21:51:55 +02:00
parent d170f0b1bd
commit 1d7b733759
3 changed files with 6 additions and 1 deletions

View File

@@ -424,7 +424,7 @@ api.cancelSubscription = async function cancelSubscription (data) {
defaultRemainingDays = 2;
}
let remaining = data.nextBill ? moment(data.nextBill).diff(new Date(), 'days') : defaultRemainingDays;
let remaining = data.nextBill ? moment(data.nextBill).diff(new Date(), 'days', true) : defaultRemainingDays;
if (plan.extraMonths < 0) plan.extraMonths = 0;
let extraDays = Math.ceil(30.5 * plan.extraMonths);
let nowStr = `${now.format('MM')}/${moment(plan.dateUpdated).format('DD')}/${now.format('YYYY')}`;