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

Business day calculations off when starting with a non-workday #196

Open
dsadaka opened this issue Nov 26, 2019 · 1 comment
Open

Business day calculations off when starting with a non-workday #196

dsadaka opened this issue Nov 26, 2019 · 1 comment

Comments

@dsadaka
Copy link

dsadaka commented Nov 26, 2019

Whether I start on a weekend date or I use the holidays feature, if my starting date is a non workday, and I add business_days to it, it will skip to the next day before doing the calculaiton.

Example1 holiday: dt = Date.civil(2019,11,11) Which is veterans day (specified in holdays)
1.business_day.after(dt) will yield Wednesday 11/13/2019 instead of Tuesday

Example2 weekend: dt = Date.civil(2019,11,17))
1.business_days.after(dt) => Tue, 19 Nov 2019

Is this by design? How do I work around this? Do I need to check the start date for .workday? after the calculation and subtract 1?

@rmm5t
Copy link
Collaborator

rmm5t commented Jun 26, 2022

@dsadaka This is by design.

For example, consider the scenario of asking for 0.business_days.after(dt) on a Sunday:

>> dt = Date.current
=> Sun, 26 Jun 2022
>> 0.business_days.after(dt)
=> Mon, 27 Jun 2022

e.g. It wouldn't make sense to return a non-business day when asking for 0 business days in future.

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