Skip to content

fix: add/subtract business days infinite loop#12

Open
lucianm05 wants to merge 1 commit into
rankmyapp:masterfrom
lucianm05:fix/add-subtract-infinite-loop
Open

fix: add/subtract business days infinite loop#12
lucianm05 wants to merge 1 commit into
rankmyapp:masterfrom
lucianm05:fix/add-subtract-infinite-loop

Conversation

@lucianm05
Copy link
Copy Markdown

No description provided.

@lucianm05
Copy link
Copy Markdown
Author

related to this issue: #6

the current implementation enters an infinite loop if the provided number is negative

Copy link
Copy Markdown

@antonio-pbilby antonio-pbilby left a comment

Choose a reason for hiding this comment

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

Isn't it possible to just use the absolute value (Math.abs()) of the given number instead of declaring different methods depending on the sign of the number?

@lucianm05
Copy link
Copy Markdown
Author

it is possible, but for my use case I would have preferred if the days had been reduced, not to check if the value I'm passing to the function is negative and calling the subtractBusinessDays function instead

at least that's the behavior I was expecting from the addBusinessDays with a negative value

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

Successfully merging this pull request may close these issues.

2 participants