Fix subscriptions ending early - fixes #8600 (#8746)

* Use “now” for calculation of the subscription end date instead of plan.dateUpdated

* add test to show previously incorrect logic does not affect sub end date.
This commit is contained in:
joe-salomon
2017-06-07 10:16:55 -07:00
committed by Sabe Jones
parent befacca457
commit 2292ba2694
2 changed files with 13 additions and 1 deletions

View File

@@ -452,7 +452,7 @@ api.cancelSubscription = async function cancelSubscription (data) {
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')}`;
let nowStr = `${now.format('MM')}/${now.format('DD')}/${now.format('YYYY')}`;
let nowStrFormat = 'MM/DD/YYYY';
plan.dateTerminated =