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

"Bridge" holidays #67

Open
mblasi opened this issue May 23, 2021 · 4 comments
Open

"Bridge" holidays #67

mblasi opened this issue May 23, 2021 · 4 comments

Comments

@mblasi
Copy link

mblasi commented May 23, 2021

Hello, here in Argentina, we have a rule for promote turism, which adds Friday as holiday when the real one is Thursday, and adds Monday when it is Tuesday.
Is there any way to represent it with the new v2 api?

Thanks!

@rickar
Copy link
Owner

rickar commented May 27, 2021

There's no built-in way to do that. You should be able to create a custom HolidayFn that returns Friday or Tuesday after checking if the original holiday is on Thursday or Tuesday.

@mblasi
Copy link
Author

mblasi commented May 27, 2021

Thank you @rickar! If I understand correctly, that HolidayFn would swap the "Thursday" with "Friday", but in my case, we need to add Friday, and finally should be two holidays: Thursday and Friday.

@rickar
Copy link
Owner

rickar commented May 29, 2021

Right. Each Holiday definition can only return one day per year so you would need to create something like TruthDay and SecondTruthDay. TruthDay would return the normal holiday every year like you currently have it with CalcDayOfMonth and SecondTruthDay would use a custom CalcBridgeDay that returns the extra day if it applies or zero time if not.

@mblasi
Copy link
Author

mblasi commented May 29, 2021 via email

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

No branches or pull requests

2 participants