diff --git a/services/web/app/src/Features/Subscription/RecurlyWrapper.js b/services/web/app/src/Features/Subscription/RecurlyWrapper.js index d5c2369009..243da6edce 100644 --- a/services/web/app/src/Features/Subscription/RecurlyWrapper.js +++ b/services/web/app/src/Features/Subscription/RecurlyWrapper.js @@ -693,12 +693,15 @@ const promises = { } }, - async extendTrial(subscriptionId, daysUntilExpire) { + async extendTrial(subscriptionId, trialEndsAt, daysUntilExpire) { if (daysUntilExpire == null) { daysUntilExpire = 7 } + if (trialEndsAt == null) { + trialEndsAt = new Date() + } const nextRenewalDate = new Date() - nextRenewalDate.setDate(nextRenewalDate.getDate() + daysUntilExpire) + nextRenewalDate.setDate(trialEndsAt.getDate() + daysUntilExpire) logger.debug( { subscriptionId, daysUntilExpire }, 'Exending Free trial for user'