We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f93534d commit a685a70Copy full SHA for a685a70
1 file changed
openwisp_radius/counters/resets.py
@@ -36,8 +36,10 @@ def _monthly(user=None):
36
def _monthly_subscription(user):
37
dt = _today()
38
day_joined = user.date_joined.day
39
+ # subscription cycle starts on the day of month the user joined
40
start = datetime(dt.year, dt.month, day_joined)
- if start > datetime.fromordinal(dt.toordinal()):
41
+ # if the start date is in the future, shift to previous month
42
+ if start > datetime(dt.year, dt.month, dt.day):
43
start = start - relativedelta(months=1)
44
end = datetime(start.year, start.month, day_joined) + relativedelta(months=1)
45
return _timestamp(start, end)
0 commit comments