Skip to content

Commit

Permalink
Fix date parsing bug
Browse files Browse the repository at this point in the history
  • Loading branch information
brylie committed Jul 3, 2023
1 parent 09e98a9 commit 4d6df66
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions subscription/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import date, datetime
from datetime import date
import json
import os
from datetime import timedelta
Expand Down Expand Up @@ -44,15 +44,7 @@ def calculate_end_date_from_braintree_subscription(
hasattr(braintree_subscription, "paid_through_date")
and braintree_subscription.paid_through_date is not None # type: ignore
):
# create new paid_through_date
# by parsing braintree_subscription.paid_through_date
# to a datetime object
paid_through_date = datetime.strptime(
braintree_subscription.paid_through_date, # type: ignore
"%Y-%m-%d",
).date()

return paid_through_date + GRACE_PERIOD_DAYS # type: ignore
return braintree_subscription.paid_through_date + GRACE_PERIOD_DAYS # type: ignore # noqa: E501
# Otherwise extend by one year with grace period
else:
return current_subscription_end_date + ONE_YEAR_WITH_GRACE_PERIOD
Expand Down

0 comments on commit 4d6df66

Please sign in to comment.