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
Holidays with identical names can return incorrect results based on order in which regions are loaded #344
Comments
While writing tests I have discovered that this only seems to occur in the following situations: Two regions each contains a function with the same name but different logic
From what I can tell when Two regions each contains a function with the same name and same logic but also have different function modifier values
This scenario is what specifically triggered this issue (because of the conflict between I now have failing tests to cover the two scenarios above as well as passing tests for a variety of other similar scenarios that do not seem to trigger the incorrect behavior. |
@ppeble Thank you for writing this issue.:) |
Quick update: I have a fix locally that addresses the second scenario from my last comment (regarding |
After a lot more digging I have decided to open a PR with my fix for the The other issue unfortunately requires a much more complex solution. I'll leave this issue open so I can continue to track progress on it but it will come in a later PR. |
Summary
Regions that share a holiday name but have different definitions for that holiday could see incorrect results based on the order that the regions are called.
Current Behavior
Loading the
br
region first means that the correct definition forco
is not used, resulting in2014-06-23
returning nothing.Expected Behavior
The holiday 'Corpus Christi' for the
co
region should be returned when querying for2014-06-23
even if other regions also containing a 'Corpus Christi' holiday are loaded first.Expected correct output while loading
br
region beforeco
region:Steps to Reproduce
function_modifier
values or have them take place on different days).holidays
viamake console
.The call to the second region will return
[]
because the first region's definition is used, even though the second region was explicitly provided as an argument.Detailed Description
This specific scenario was found via the PR to fix Colombian holidays and only presents itself using the updates in that PR. However this behavior would exist in any other similar scenario.
The issue in this ruby implementation is that the
co
andbr
regions both have an entry namedCorpus Christi
but they have different logic:Colombia:
Brazil:
The text was updated successfully, but these errors were encountered: