Comments (4)
Hi @samstickland! Sorry for the delay, had a busy week.
Currently I don't think we can give you what you seem to need. All I can give you at the moment is a list of all of the regions we have available:
Holidays.load_all
Holidays.regions # <- returns an array of all available region symbols (i.e. :gb, :us, etc)
This isn't exactly what you want but currently we don't map an English name, let alone a i18n'ed name. That'll have to be something we add.
As to your second point, the issue is that :gb
is an overall 'parent' (for lack of a better term) region. Really :gb_con
should be a sub-region of :gb_eng
, if I understand correctly (I'm American so I might have my names/regions wrong).
I'll need to think about this as well, as I can definitely see a use for it but up to this stage we haven't needed to do it. In our current nomenclature we would want to do something like :gb_eng_con
to indicate that 'Cornwall' belonged as a sub-region of :gb_eng
but I don't think our current logic will allow that.
These are a reasonable requests. I'm going to leave this open as a feature request and work on it in the near future, I think it's doable. No timeframe at this time, though.
from holidays.
If you have the countries gem installed then you can do something like this...
Holidays.available_regions.sort.uniq.map{|r|
ISO3166::Country[r] ? [ ISO3166::Country[r].name , r ] : nil }.compact.sort_by{|a| a[0]}
=> [["Argentina", :ar], ["Austria", :at], ["Australia", :au], .....
BTW, 'Christmas Day' does not seem to be listed as a holiday for Australia (:au).
from holidays.
@jlsync Hm, interesting! Unfortunately one problem is that not all of our regions are currently ISO compatible, I don't think. Since I've taken over any new regions must be and I've been correcting them as I've found issues but I would have to do an audit to figure out which ones are 'incorrect' currently. Still a good option to have, though. Thank you!
To your second point, bah! I missed this in past refactorings. I'm going to create another issue so I don't lose track of it. Thank you!
from holidays.
I went through the symbols and found the names for each of them and put them in a hash in this gist. (It's already slightly out of date with the latest changes to the definitions from a month ago but should be quite fast to clean it up).
A bit of feedback about things I discovered while going through the list:
Duplicates
- Isle of Man is listed as both
:im
and:gb_iom
(seems to be on purpose, not sure why) :es_v
(Valencia) and:es_vc
(Valencian Community) encode the same data as well- (Maybe in case there's ever another refactor, aliases could be supported, so a region can have multiple names and codes, but there's also a way to get a listing without duplication?)
- Localisation has somehow snuck its way in as separate symbols for a couple of countries, Belgium and Bulgaria, with the symbols
:be_fr
,:be_nl
, and:bg_bg
,:bg_en
even though they (as far as I can tell) encode exactly the same holidays.
Very detailed sub-regions and organizations
- Not a bug per se, but at least for my use cases I don't want to ask my users if they come from Northern or Southern Tasmania (
au_tas_north
andau_tas_south
) - if the level of detail you care about is only country and state, but not further down than that, then stick to only the:xx
and:xx_xx
symbols, but leave out thexx_xx_xx
- Similarly, if a user only wants geographic regions, then they manually have to leave out all the organisation symbols like
:nyse
(New York Stock Exchange),ecb_target
(European Central Bank) and similar. Some kind of categorization of the symbols, so a user of the gem could ask for e.g. 'countries', 'regions', 'sub-regions', 'organizations' separately would be nice.
from holidays.
Related Issues (20)
- Release a new version to allow this gem to be used with Ruby 3.0 HOT 4
- Get a list of all holidays possible for a given region
- Manage Belgium parent region HOT 1
- I have an issue with columbus day HOT 1
- Version Bump Request HOT 4
- Korea's new year get next year's new year
- Islamic holidays
- Día de los Muertos is not listed
- How to prevent stacked observed holidays HOT 1
- GB Substitute Days over Christmas and New Year HOT 1
- Liberation Day, Region NL
- Queen Elizabeth II passing Bank Holiday HOT 10
- Loading custom holidays clears all the provided definitions? HOT 1
- Strange behavoir with end_of_month HOT 2
- Feast of San Giusto for Trieste, Italy should be on 3rd November
- Shouldn't July 3, 2026 be "Independence Day (observed)" in the US? HOT 2
- Project updates HOT 10
- Hanukkah does not appear in list of holidays HOT 1
- Black Awareness Day is not listed for Brazil HOT 1
- Carnival 2024 Missing from Brazil Holidays Listing HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from holidays.