Fix date of subscriptions when next month as less days than excepted
closes #1347
This commit is contained in:
parent
4e8e478efe
commit
8a3c79e8ee
1 changed files with 6 additions and 1 deletions
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
import calendar
|
||||||
from datetime import datetime, date, time
|
from datetime import datetime, date, time
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
|
|
@ -140,7 +141,11 @@ class DetailsPage(BasePage):
|
||||||
mydate = mydate.replace(month=1)
|
mydate = mydate.replace(month=1)
|
||||||
mydate = mydate.replace(year=mydate.year + 1)
|
mydate = mydate.replace(year=mydate.year + 1)
|
||||||
else:
|
else:
|
||||||
mydate = mydate.replace(month=mydate.month + 1)
|
try:
|
||||||
|
mydate = mydate.replace(month=mydate.month + 1)
|
||||||
|
except ValueError:
|
||||||
|
lastday = calendar.monthrange(date.year, date.month + 1)[1]
|
||||||
|
mydate = mydate.replace(month=mydate.month + 1, day=lastday)
|
||||||
return mydate
|
return mydate
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue