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

Support ISO 3166-2 codes for subdivisions of countries #374

Closed
mborsetti opened this issue Oct 8, 2020 · 2 comments
Closed

Support ISO 3166-2 codes for subdivisions of countries #374

mborsetti opened this issue Oct 8, 2020 · 2 comments

Comments

@mborsetti
Copy link
Contributor

python-holidays only supports prov and state subdivisions, however states are subdivided into one or more from these categories:

  • cantons
  • commune
  • councils
  • counties
  • departments
  • dependencies
  • districts
  • divisions
  • emirates
  • entities
  • governorates
  • governorates
  • islands, groups of islands
  • Länder
  • administrations
  • municipalities
  • parishes
  • prefectures
  • provinces
  • rayons
  • regions
  • sectors
  • states
  • territories
  • towns
  • unitary authorities
  • voivodships
  • wards

Instead of expanding the types of subdivisions naming supported by this library, I propose adopting ISO 3166-2 (https://en.wikipedia.org/wiki/ISO_3166-2) which already standardizes all types of subdivisions into a non-overlapping namespace.

I envision being able to initialize holidays for the state of California in the USA (ISO 3166-2 code US-CA) as follows:
us_ca_holidays = holidays.US('CA'),
for the Emirate of Dubai as follows:
dubai_holidays = holidays.AE('DU'),
for the Ağsu rayon in Azerbajan as follows:
az-agu_holidays = holidays.AZ('AGU')
and so on.

@dr-prodigy I can work on a pull request [with backward compatibility] if I know it's going to be utilized, but won't work on it otherwise.

@dr-prodigy
Copy link
Collaborator

dr-prodigy commented Nov 17, 2020

Hey there @mborsetti
sorry this proposal went unnoticed until now, my bad!

This is definitely a great idea, which would provide a definitely higher flexibility in the config/init phase.. especially if coupled to .CountryHoliday('[CODE]').

As long as we provide compatibility with previous versions, I totally agree with your analysis and would really appreciate your improvement. In the meanwhile, I can help you out with the task, if you wish.

thx loads 👍

@dr-prodigy
Copy link
Collaborator

Released with #608 merge. Thx!

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