Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to handle 'months' in recurring billing #5

Closed
pnegahdar opened this issue May 31, 2013 · 1 comment
Closed

How to handle 'months' in recurring billing #5

pnegahdar opened this issue May 31, 2013 · 1 comment

Comments

@pnegahdar
Copy link
Contributor

Currently months are handled using dateutil's relativedelta. A sample output:

day_start = datetime(year=2012,month=1, day=29)
for each in range(20):
... day_start += relativedelta(months=1)
... print day_start
...
2012-02-29 00:00:00
2012-03-29 00:00:00
2012-04-29 00:00:00
2012-05-29 00:00:00
2012-06-29 00:00:00
2012-07-29 00:00:00
2012-08-29 00:00:00
2012-09-29 00:00:00
2012-10-29 00:00:00
2012-11-29 00:00:00
2012-12-29 00:00:00
2013-01-29 00:00:00
2013-02-28 00:00:00
2013-03-28 00:00:00
2013-04-28 00:00:00
2013-05-28 00:00:00
2013-06-28 00:00:00
2013-07-28 00:00:00
2013-08-28 00:00:00
2013-09-28 00:00:00

How good is this 'monthly' strategy for a recurring billing system? Someone pointed out this http://bit.ly/15gLHsZ as an alternative strategy. I think this way makes more sense because you stay within the scope of the current month and it automatically adjusts for leapyears, shorter months, etc.

@fangpenlin
Copy link
Contributor

@pnegahdar
Nice third-party package evaluation and decision you made there. By using dateutil, it saves lots of my time. Thanks.

So far, I think this approach is good enough for most use cases, so I close this issue here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants