timezone aware
This commit is contained in:
parent
bd91883369
commit
f1790445cd
1 changed files with 2 additions and 2 deletions
|
@ -1,9 +1,9 @@
|
|||
from datetime import datetime
|
||||
import os
|
||||
import logging
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
from django.utils.functional import cached_property
|
||||
from Crypto.PublicKey import RSA
|
||||
from membership.models import StripeCustomer, CustomUser
|
||||
|
@ -176,7 +176,7 @@ class VMDetail(models.Model):
|
|||
terminated_at = models.DateTimeField(null=True)
|
||||
|
||||
def end_date(self):
|
||||
end_date = self.terminated_at if self.terminated_at else datetime.now()
|
||||
end_date = self.terminated_at if self.terminated_at else timezone.now()
|
||||
months = relativedelta(end_date, self.created_at)
|
||||
end_date = self.created_at + relativedelta(months=months)
|
||||
return end_date
|
||||
|
|
Loading…
Reference in a new issue