-
Notifications
You must be signed in to change notification settings - Fork 64
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
feat(holiday-generator): support state holidays #407
Conversation
to support state & regional holidays
specifying a state will output both state and country holidays
put("Australia - Australian Capital Territory", "australiancapitalterritory.ics") | ||
put("Australia - New South Wales", "newsouthwales.ics") | ||
put("Australia - Northern Territory", "northernterritory.ics") | ||
put("Australia - Queensland", "queensland.ics") | ||
put("Australia - South Australia", "southaustralia.ics") | ||
put("Australia - Tasmania", "tasmania.ics") | ||
put("Australia - Victoria", "victoria.ics") | ||
put("Australia - Western Australia", "westernaustralia.ics") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally the states should be hidden and only shown when expanding "Australia" to avoid cluttering the list.
Something like this,
Australia
- Australian Capital Territory
- New South Wales
- ...
Modification in the generator looks ok. However, it would be nice if for ID generation we were able to differentiate between state-specific and countrywide holidays. This way, if someone would like to have holidays for two states, they won't have duplicate entries for countrywide holidays. Also, I think that in the future, two things should be done:
|
Multiple states may share some holidays, so duplicates can't be completely avoided that way. The following is apple's approach. For Australia holidays, state holidays are suffixed relevant state(s), e.g.
None of the above approaches is suitable for every countries, programmatically include all approaches is not ideal either. I think a better approach would be to keep using holiday-generator while still accepting community contribution (that also opt-out a country from holiday-generator). If a (country) holiday is out of date, we can always opt back in that country into automation. I'm closing this in favor of #416 . |
Now you did it for Australia and Malaysia. There's already Germany in the queue. There will probably also be requests for the United States, Canada, and who knows what else. Going this way, we may just remove the holiday generator and go back to the old times, where Calendar was relying only on contributors, and holidays weren't updated for years.
In my opinion, in software development, there's no such thing as "it can't be done". Even if an external library has some limitations, there are always ways to omit them. For example, a great way (if we don't want to write any custom logic) would be to raise a feature request in the date-holidays and maybe even a pull request. To conclude, I think that this PR should be reopened as it proposed a proper solution. And, PRs #416 and #422 should be closed. CC @naveensingh |
I thought about this and still prefer the approach I mentioned in my other comment:
This should resolve issues like #379 and #413 without complicating things too much. Google Calendar has a similar option: X-HOLIDAY-TYPE: Possible field values could be just:
or it could be all the types from https://www.npmjs.com/package/date-holidays#types-of-holidays but merging them into just two types will keep things easy for those who are looking to add holidays for an unsupported country. Alternative ideas and opinions are welcome. I'll probably work on this tomorrow unless someone beats me to it. |
It will solve the problem of non-public holidays, but what with regional holidays? They still can be public, but only for a specific region. Probably it would be the best to support all regions for countries that have them (according to https://www.npmjs.com/package/date-holidays#supported-countries-states-regions), not only for already reported ones. Just an idea - maybe in the future, instead of ICS files, you could just build holidays from YML files from date-holidays (https://github.com/commenthol/date-holidays/tree/master/data/countries)? You could add them as a GIT Submodule. It will require writing a parser, but will be more flexible. |
As in, add a separate ICS file and UI option for each region like suggested in this comment? I was thinking All holidays option should include all holidays (including those only observed in specific regions) for a given country.
One step at a time ;) |
Something like this. Or, show another dialog with regions because e.g. USA will bloat the UI with their 53 regions (states + cities with separate holidays) |
What is it?
Description of the changes in your PR
Acknowledgement