Split holiday calendars into public ([country]-public.py) and other ([country]-other.py) categories
Do not close this issue solely because the Swedish calendar was updated without splitting; at least one country calendar must be SPLIT into public ([country]-public.py) and other ([country]-other.py) first.
Is your feature request related to a problem? Please describe
The current calendar files combine legally mandated public holidays and de facto or cultural holidays. Public holidays are the ones required by law.
For example, in Sweden, the following are not public holidays because they are not listed in the Swedish Parliament legal document:
Förordning (1989:253) om allmänna helgdagar:
- Jungfru Marie bebådelsedag
- Midsommarafton
- Nyårsafton
- Julafton
People are CalDAV subscribing calendars from https://www.thunderbird.net/en-US/calendar/, for example SwedishHolidays.ics, and use them with calendar software. Thunderbird developers are evaluating the vacanza/holidays library to generate the SwedishHolidays.ics file, see:
- https://github.com/thunderbird/thunderbird-website/issues/753
- https://github.com/thunderbird/thunderbird-website/issues/941#issuecomment-3439894463
However, the vacanza/holidays calendars are not split. Currently it is not possible to hide selected categories in these software:
- Etar: Hide Event/Task Categories - https://github.com/Etar-Group/Etar-Calendar/issues/2000
- Fossify Calendar: Hide Event/Task Categories - https://github.com/FossifyOrg/Calendar/issues/911
- Thunderbird: Hide Event/Task Categories - https://bugzilla.mozilla.org/show_bug.cgi?id=2003212
So users must manually split ICS files, a time-consuming process that most will avoid.
Describe the solution you'd like
Split the calendars into two files:
[country]-public.py: Contains only public holidays mandated by law.[country]-other.py: Contains other culturally important or de facto holidays.
Example: Sweden
- Move "Jungfru Marie bebådelsedag", "Midsommarafton", "Nyårsafton", and "Julafton" from the current sweden.py to a new file called sweden-other.py
- Rename sweden.py to sweden-public.py with only the legally mandated public holidays remaining.
Describe alternatives you've considered
Currently using date-holidays, which implements this exact split:
- Public holidays ICS:
https://github.com/FossifyOrg/Calendar/blob/main/app/src/main/assets/holidays/SE/public.ics - Other days ICS:
https://github.com/FossifyOrg/Calendar/blob/main/app/src/main/assets/holidays/SE/other.ics
References
- Swedish legal basis for public holidays:
Förordning (1989:253) om allmänna helgdagar- Note: Act 1952:48, was effectively replaced by Act 1989:253.
- Wikipedia overview:
https://en.wikipedia.org/wiki/Public_holidays_in_Sweden
- https://github.com/thunderbird/thunderbird-website/issues/941
Hi @davidhedlund Thanks for submitting this.
I believe we need a better understanding of a problem you're trying to solve. Open World Holidays Framework has a user facing category concept (may be not that well documented yet, need to revisit recent issues) and by default only PUBLIC category holidays are in use. You can extend the holiday list by using other entity supported categories.
Splitting the code may seem like a good idea however I doubt it's the way we want to go at least for v0. We might consider it for v1 but for now as a core team member I don't see any benefits of supporting multiple files instead of just a single one (e.g. code duplication, migration, categories deprecation). Please let me know if I'm missing some of your points.
For the specific examples of Jungfru Marie bebådelsedag, Midsommarafton, Nyårsafton, Julafton -- we are open to update holidays based on official sources.
@KJhellico could you check relevancy of SE holidays we currently have? Thank you
Hi @davidhedlund Thanks for submitting this.
Hello!
Splitting the code may seem like a good idea however I doubt it's the way we want to go at least for
v0. We might consider it forv1...
I completely understand that this issue cannot be prioritized at the moment. I appreciate your consideration in keeping the issue open for future re-evaluation in upcoming versions. Thank you very much for your time and attention. 🙏
As I understand, Midsummer Eve, Christmas Eve and New Year's Eve can be classified as OPTIONAL in terms of our project.
As for Feast of the Annunciation (Marie bebådelsedag), I didn't quite understand. Act 1952:48 set it on Sunday between Mar 22-28; Act 1989:253 does not mention it in public holidays list. So it was a holiday until 1990, and then it became OPTIONAL? @davidhedlund, could you explain it in more detail?
Wiki also mentions "De facto half holidays": Trettondagsafton, Valborgsmässoafton, Alla helgons afton, and "Eves always on Saturdays": Påskafton and Pingstafton. How common are they, and should they also be included in OPTIONAL category?
As I understand, Midsummer Eve, Christmas Eve and New Year's Eve can be classified as
OPTIONALin terms of our project.
Great!
As for Feast of the Annunciation (Marie bebådelsedag), I didn't quite understand. Act 1952:48 set it on Sunday between Mar 22-28; Act 1989:253 does not mention it in public holidays list. So it was a holiday until 1990, and then it became OPTIONAL? @davidhedlund, could you explain it in more detail?
Jungfru Marie bebådelsedag in a Swedish official calendar is relevant as a traditional and religious observance, even though it is not an official public holiday anymore. Although not officially recognized by everyone, many Swedes today refer to it as 'Waffle Day' and celebrate by enjoying waffles. If you want consistency, either remove Jungfru Marie bebådelsedag from the calendar, or or add all days listed at https://sv.wikipedia.org/wiki/Helgdagar_i_Sverige#1571_%C3%A5rs_kyrkoordning
Wiki also mentions "De facto half holidays": Trettondagsafton, Valborgsmässoafton, Alla helgons afton, and "Eves always on Saturdays": Påskafton and Pingstafton. How common are they, and should they also be included in
OPTIONALcategory?
These days can appropriately be included in an OPTIONAL category in a Swedish calendar because they are culturally significant and commonly observed with reduced work despite not being official holidays.
Jungfru Marie bebådelsedag in a Swedish official calendar is relevant as a traditional and religious observance, even though it is not an official public holiday anymore. Although not officially recognized by everyone, many Swedes today refer to it as 'Waffle Day' and celebrate by enjoying waffles. If you want consistency, either remove Jungfru Marie bebådelsedag from the calendar, or or add all days listed at https://sv.wikipedia.org/wiki/Helgdagar_i_Sverige#1571_%C3%A5rs_kyrkoordning
1571 seems too distant. :) And after that, there were changes at least in 1772. So let's take 1953 as our starting point. Since "Marie bebådelsedag" is mentioned in Act 1952:48, it would be reasonable to make it a holiday until 1990.
Regarding "half holidays": would it be correct to name them as "Trettondagsafton (eftermiddag)" and so on? I took English "afternoon" as a basis - how correct does it sound in Swedish?
Regarding "half holidays": would it be correct to name them as "Trettondagsafton (eftermiddag)" and so on? I took English "afternoon" as a basis - how correct does it sound in Swedish?
It's good to include the half-day holidays, but please use the established correct English and Swedish names as listed in https://en.wikipedia.org/wiki/Public_holidays_in_Sweden -- everything is correct in that page. Using the proper terminology preserves clarity and avoids awkward or incorrect expressions. "Afternoon" is an unexpected or unfounded expression for Trettondagsafton.
Our current standard for half-day holidays includes labeling their beginning times: Andorra, Australia, Iceland, Macau, Turkey (both for HALF_DAY category and when holidays of other categories have this property). That is why I consider it reasonable to follow this approach for Sweden as well.
Regarding "half holidays": would it be correct to name them as "Trettondagsafton (eftermiddag)" and so on? I took English "afternoon" as a basis - how correct does it sound in Swedish?
@KJhellico I misunderstood you because you only gave a single day as an example, so I thought you were suggesting alternative names for the anniversaries.
Yes, “afternoon off” is the correct term. According to the Wikipedia article on public holidays in Sweden, "The de facto half holidays are often treated with the afternoon off, but this varies depending on employer. It is more common to work a full workday than not these days. Many of the employees that have half days off have a slightly longer workweek the rest of the year to compensate for the time off. In many cases employees take the whole day off, combining the half holiday with some other form of leave."
Ok, so "eftermiddag" is correct Swedish term for that case?
Ok, so "eftermiddag" is correct Swedish term for that case?
Yes, that is correct.
Do not close this issue solely because the Swedish calendar was updated without splitting; at least one country calendar must be SPLIT into public ([country]-public.py) and other ([country]-other.py) first.
Do not close this issue solely because the Swedish calendar was updated without splitting; at least one country calendar must be SPLIT into public ([country]-public.py) and other ([country]-other.py) first.
@davidhedlund could you explain what would be the benefits of this restructuring for the community? We already offer a way to get PUBLIC (and other supported categories) holidays pretty easily.
Could you describe your use case and let us suggest the best way to work around it? As of now it looks to me that you just need get all PUBLIC category holidays first and then exclude PUBLIC from the supported categories and get the rest of holidays (others).
// It seems I can't unlink the pr/issue for some reason -- it doesn't change the relation after I uncheck the PR here.
As of now it looks to me that you just need get all PUBLIC category holidays first and then exclude PUBLIC from the supported categories and get the rest of holidays (others).
Can you please guide me how to do this on any Android or GNU/Linux calendar software in detailed steps in bullets?
How do I generate the Swedish ICS calendar?
It sounds like you want to be able to create these .ics files:
- https://github.com/FossifyOrg/Calendar/blob/main/app/src/main/assets/holidays/SE/public.ics
- https://github.com/FossifyOrg/Calendar/blob/main/app/src/main/assets/holidays/SE/other.ics
Again, I don't see a clear use case description here so I can only guess. However, in any case if it's not something that is part of holidays package yet (e.g. ics files) you can:
- either automate it yourself (ask here for help if needed) with Python or
- file a feature request for adding those files as part of the package (depends on impact/interest to the community)
After https://github.com/vacanza/holidays/pull/3096 is merged it should be quite easy to do (currently we support only PUBLIC category for Sweden).
How do I generate the Swedish ICS calendar?
I'll task AI for some code examples later today if you'd like.
It sounds like you want to be able to create these .ics files:
* https://github.com/FossifyOrg/Calendar/blob/main/app/src/main/assets/holidays/SE/public.ics * https://github.com/FossifyOrg/Calendar/blob/main/app/src/main/assets/holidays/SE/other.ics
Sorry, these ICS files cannot be generated using vacanza/holidays, as Fossify Calendar relies on the date-holidays (from the commenthol repository) library, as noted in the main post.
I need to generate the Swedish vacanza/holidays to evaluate them: Thunderbird developers are evaluating the vacanza/holidays library to generate the SwedishHolidays.ics file, see https://github.com/thunderbird/thunderbird-website/issues/941#issuecomment-3439894463
This is what I get (with #3096 update, years 2021-2030):
(remove .txt from names - GitHub does not allow .ics files to be attached)
This is what I get (with #3096 update, years 2021-2030):
(remove
.txtfrom names - GitHub does not allow .ics files to be attached)
Can you please paste the Python recipe here?
@davidhedlund could you explain what would be the benefits of this restructuring for the community? We already offer a way to get PUBLIC (and other supported categories) holidays pretty easily.
People are CalDAV subscribing calendars from https://www.thunderbird.net/en-US/calendar/, for example SwedishHolidays.ics, and use them with calendar software. Thunderbird developers are evaluating the vacanza/holidays library to generate the SwedishHolidays.ics file, see https://github.com/thunderbird/thunderbird-website/issues/941#issuecomment-3439894463
However, the vacanza/holidays calendars are not split. Currently it is not possible to hide selected categories in these software (I just submitted all issues!):
- Etar: Hide Event/Task Categories - https://github.com/Etar-Group/Etar-Calendar/issues/2000
- Fossify Calendar: Hide Event/Task Categories - https://github.com/FossifyOrg/Calendar/issues/911
- Thunderbird: Hide Event/Task Categories - https://bugzilla.mozilla.org/show_bug.cgi?id=2003212
So users must manually split ICS files, a time-consuming process that most will avoid.
@arkid15r
Can you please paste the Python recipe here?
In this case, it's something like
from holidays.countries.sweden import SE
from holidays.ical import ICalExporter
def generate():
language = "sv"
years = range(2021, 2031)
for category in SE.supported_categories:
holidays = SE(include_sundays=False, years=years, categories=category, language=language)
file_path = f"SE_COMMON_{language.upper()}_{category.upper()}.ics"
ICalExporter(holidays).save_ics(file_path)
if __name__ == "__main__":
generate()
The only difference is that the .ics files attached above also have ICal property CATEGORIES (which requires additional changes to ICalExporter).
So users must manually split ICS files, a time-consuming process that most will avoid.
This task should be resolved at the files generation stage. 🤷♂️