Skip to content

BDay() subtraction bug when the starting date is not on offset #2680

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

Closed
rhaskett opened this issue Jan 10, 2013 · 0 comments
Closed

BDay() subtraction bug when the starting date is not on offset #2680

rhaskett opened this issue Jan 10, 2013 · 0 comments
Labels
Bug Datetime Datetime data dtype
Milestone

Comments

@rhaskett
Copy link

Note the output skips the weekday 12/23/2011.

dt = datetime(2012, 1, 1)

for i in range(1,10):
    print i, (dt - i * BDay()).strftime('%m/%d/%Y')

1 12/30/2011
2 12/29/2011
3 12/28/2011
4 12/27/2011
5 12/26/2011
6 12/22/2011
7 12/21/2011
8 12/20/2011
9 12/19/2011

however when the start date is onoffset it works fine

dt = datetime(2011, 12, 30)

for i in range(1, 10):
    print i, (dt - i * BDay()).strftime('%m/%d/%Y')

1 12/29/2011
2 12/28/2011
3 12/27/2011
4 12/26/2011
5 12/23/2011
6 12/22/2011
7 12/21/2011
8 12/20/2011
9 12/19/2011

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

No branches or pull requests

2 participants