holidays / holidays

A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Underscores used in determining parent regions conflict with regions that are named with underscores

ppeble opened this issue · comments

Any region that does not have an iso 3166 name and use underscores in their names run into an issue. We use underscores to determine 'parent' regions and 'sub-regions'. For example, us_va is a subregion of us. This way holidays in the 'parent' region still apply to the subregion.

This logic is also applied to these non-standard regions. Up until now it hasn't mattered...there is no ecb parent region for the ecb_target region so nothing is done.

With the addition of holidays/definitions#109 however now have federal_reserve and federal_reserve_banks. When we try to use federal_reserve_banks it assumes that federal_reserve is the parent region and also includes holidays it finds from the parent. This is incorrect.

Unfortunately I don't see a way around changing the non-standard region names. As it stands the underscore denotes a subregion. By naming thing like ecb_target and federal_reserve we inherently undermine this idea.

Proposal

We change all regions that are non-standard to use no underscores. Anything with an underscore is a subregion. So ecb_target becomes ecbtarget, federal_reserve becomes federalreserve, etc.

This has the benefit of leaving 'underscores mean a subregion'. It has the problem of the fact that it is a breaking change and would require a major version bump.

I am open to other suggestions!

Affected regions

  • ecb_target -> ecbtarget
  • federal_reserve -> federalreserve
  • federal_reserve_banks -> federalreservebanks
  • north_america_informal -> northamericainformal
  • united_nations -> unitednations
  • north_america -> northamerica
  • south_america -> southamerica

I am tagging a few people into this so that they can weigh in because they have opened an issue, commented on an issue, or opened a PR related to this specific area (namely federal reserve stuff):

And I'll tag in @ttwo32 so you are also aware. 😄

One last ping of @mhickman @mikecanann @StephenWetzel @poojawins before I move forward with my plans to remove underscores for the affected non-standard regions above. This will be a breaking change and so the gem will jump to v7 to indicate this.

I likely won't get to this until at least this coming weekend.

Addressed in referenced PR. New version is v7.0.0.