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

update steps to reach next month #958

Merged
merged 2 commits into from Jul 14, 2020

Conversation

vansika
Copy link
Member

@vansika vansika commented Jul 12, 2020

from_date = datetime(2020, 6, 30)
date = from_date + relativedelta(days=32)
print(date) = 2020-08-01 00:00:00

ideally, it should be 2020-07-01 00:00:00

I guess the problem is that we are using 32 as steps to reach the next month, it should be 31.

@vansika vansika marked this pull request as ready for review July 12, 2020 09:06
@vansika vansika requested a review from mayhem July 12, 2020 09:06
@mayhem
Copy link
Member

mayhem commented Jul 13, 2020

I don't think 32 or 31 are the right things here. You want to go 1 month into the future, yes? Why not?

from dateutil import relativedelta
from datetime import datetime
from_date = datetime(2020, 6, 30)
date = from_date + relativedelta.relativedelta(months=1)
date
datetime.datetime(2020, 7, 30, 0, 0)

@vansika
Copy link
Member Author

vansika commented Jul 13, 2020

@mayhem 🤣🤣🤣

@vansika
Copy link
Member Author

vansika commented Jul 13, 2020

Dumb me 🤦‍♀️

Copy link
Member

@mayhem mayhem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, the code already existed! :)

@vansika vansika merged commit b4bda77 into metabrainz:master Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants