nextcloud / calendar

📆 Calendar app for Nextcloud
https://apps.nextcloud.com/apps/calendar
GNU Affero General Public License v3.0
985 stars 240 forks source link

Easily add holidays #962

Closed ryanprior closed 1 year ago

ryanprior commented 5 years ago

There ought to be an easy, obvious interface to add a standard holiday calendar to your NextCloud.

In https://github.com/nextcloud/server/issues/1363 the request was made to "make national holidays available in calendar" and this was implemented by allowing webcal subscriptions. That technically works but it has these drawbacks:

A way to resolve this is to provide a convenient interface for users to find a holiday calendar that's relevant to them and add it in a few clicks, without having to know about the implementation. Advantages of this approach:

## Acceptance criteria * Use upstream data from https://www.thunderbird.net/en-US/calendar/holidays/ * New entry in *+ New calendar* -> modal with list of countries/regions -> add as new subscription * UI is in Calendar app. If Calendar is not installed/enabled the feature is not visible * Optional: Subscriptions should be shareable (example: admin adds company holidays and shares with everyone) * Requires https://github.com/nextcloud/server/issues/1600 ## Work packages - [x] MVP: Add a link to the subscription menu that sends people to the Thunderbird subscription site https://github.com/nextcloud/calendar/pull/5166 - [x] Main implementation that fulfills the acceptance criteria https://github.com/nextcloud/calendar/pull/5167 - [x] https://github.com/nextcloud/documentation/issues/10018 ## Follow-ups * https://github.com/nextcloud/calendar/issues/5168
georgehrke commented 5 years ago

I would really like to ship holiday calendars, but the biggest problem is: Where to get the data from?

It should be obvious that we can’t copy and paste the Google Holiday calendars for copyright reasons.

@ryanprior Are you aware of any database that offers holiday data under a free (foss) license?

ryanprior commented 5 years ago

Wikimedia Commons has your back, with holiday data covering the globe and dozens of cultures, all under Creative Commons Attribution-ShareAlike:

Just doing this research is making clear to me the enormity of this task. It seems like massaging all this into a query-friendly format would be an undertaking all by itself. Possibly if we reach out to Wikimedia they might know somebody who has already done this?

I'm also aware that libraries often have query-friendly databases that they share with people. I'll ask a librarian if they have further ideas and report back here.

Another thing worth pointing out is that this problem can be significantly collapsed: building holiday support for a few locales could cover most of NextCloud's user base and simultaneously lay the groundwork for global coverage once the appropriate comprehensive database is made available.

tcitworld commented 5 years ago

So it's basically unusable until the data is filled into Wikidata or someone finds an existing tool to scrape it from Wikipedia. :/

ryanprior commented 5 years ago

At least more usable than scraping from Google Calendar. I'm investigating to see if there's a convenient option that already exists.

cbrace commented 5 years ago

There is a large collection of national holiday calendars for Lightning on the Mozilla site. The ICS file can be dowloaded or added as an online calendar subscription. I have just downloaded and imported into Nextcloud the ICS holiday file for the Netherlands (contains holidays up to the year 2050), and this works fine.

Theoretically it might be preferable to have an "internal" Nextcloud solution, but why reinvent the wheel?

https://www.thunderbird.net/en-US/calendar/holidays/

tcitworld commented 5 years ago

Thanks for the link!

The issue is that there's no way to link to a specific ICS file from the information we have (language, locale). So there's multiple options:

Moreover these calendars don't seem to have school holiday informations (at least for France) and specific public holidays for some regions.

cbrace commented 5 years ago

I probably should have emphasized that this is a rather crude workaround until something better can be arranged.

Regarding school vacations, I appreciate that might be useful info, but seems to me it belongs in a separate calendar from national holidays.

Also, I don't know how they are planned in France, but here in NL the start and end dates are now staggered geographically and rotated every year to reduce congestion. It might not be possible to "program" such a calendar very far in the future, at least in this particular case.

It might be an idea to alert the Thunderbird/Lightning team to the fact that these calendars are useful for other applications as well, and look into creating some kind of simple interface for retrieving them.

ryanprior commented 5 years ago

Incremental steps in this direction are a good idea. In order of fanciness, we could: 1) write a help page about how to use WebCal + this Mozilla list to add holidays 2) add an option in the UI that links to that help page 3) autodetect the locale and offer to import the appropriate calendar in the UI 4) create a NextCloud-native solution, perhaps using the Mozilla data as a backend, perhaps not

Each one of those steps that we take brings an incrementally better experience for our users. This is an area where our interests are aligned with the Mozilla Lightning folks and we should take advantage of that in any way we can, whether that means linking to them, consuming their webcal feeds automatically, or using the same backing data in our own native approach. Reaching out to them seems like a good idea- @cbrace will you open a line of communication and link to the discussion here so people can follow?

cbrace commented 5 years ago

Done! I posted here: https://discourse.mozilla.org/t/holiday-calendars-useful-resource/39993

In an earlier life I worked as a technical writer, and I would be happy to lend a hand with a help page, if pointed in the right direction.

georgehrke commented 5 years ago

@cbrace That would be really great!

Contributing to our documentation is really easy. Just fork our documentation repo, edit this rst file and send a pull request. Once it's merged, our online documentation will automatically be updated within minutes.

cbrace commented 5 years ago

@georgehrke Done!

This is my first pull request on Github, so I hope I did it correctly.

One thing I wasn't sure about is whether importing calendars from file is available for all users, or whether it can be disabled by an admin.

I believe it is possible to subscribe to the calendars published on the thunderbird site rather than downloading and importing. I could test this and add it if people think it is a good idea. (I prefer to import myself)

georgehrke commented 5 years ago

Resource from KDE: https://cgit.kde.org/kholidays.git/tree/holidays/plan2 NPM lib to generate date of easter: https://www.npmjs.com/package/@pacote/computus

The source from KDE seems more reliable than Mozilla.

Ideally this should be implemented as an individual app registering its own calendars. Let's keep this open for tracking the progress.

georgehrke commented 5 years ago

For reference: https://github.com/nextcloud/server/issues/17126

nadimattari commented 5 years ago

On KHolidays, I maintain the holidays for Mauritius (https://github.com/KDE/kholidays/blob/master/holidays/plan2/holiday_mu_en). How can I help to maintain the same here, if any?

ryanprior commented 5 years ago

Hi @nadimattari, thanks for volunteering to help maintain Nextcloud! @georgehrke is working on an addition to the Nextcloud framework that will allow applications to add dates to the calendar. Then we can create a Nextcloud app, perhaps based on the KDE calendar data, which can handle holidays.

So if you're interested in getting involved with Nextcloud development, you could start building an app which assumes some as-yet-unspecified API for exposing calendar events, and pulls data from KDE repositories to do so.

We could also use help finding or creating documentation for how to easily make use of KDE's holiday data without using the KDE framework, for example using PHP.

Thanks again, we're glad to have you here!

tcitworld commented 3 years ago

Open your browser console (usually with F12), retry, and post anything suspicious you see here in a new issue, please.

However you should add the URL as a subscription instead of importing it to a real calendar.

tcitworld commented 2 years ago

For those interested in this issue, I wanted to mention I created an app allowing to subscribe easily to various public holidays: https://apps.nextcloud.com/apps/holiday_calendars

ryanprior commented 2 years ago

Nice! I'm going to try it out.

jjasoncool commented 1 year ago

For those interested in this issue, I wanted to mention I created an app allowing to subscribe easily to various public holidays: https://apps.nextcloud.com/apps/holiday_calendars

Can this app add custom link (e.g. google calendar ics) and share to some member?

The default function in calendar add subscribe by link only for myself, I can't share the calendar to another person.

https://github.com/nextcloud/server/issues/1600

Thank you.

ChristophWurst commented 1 year ago

@tcitworld fyi we are planning to work on this and add a shortcut to Calendar to add subscriptions from https://www.thunderbird.net/en-US/calendar/holidays easily

ChristophWurst commented 1 year ago

Bildschirmfoto vom 2023-04-27 12-52-48

^ @nimishavijay @jancborchardt for design feedback. If there are bigger changes please provide us with a mockup :)

nimishavijay commented 1 year ago

Super nice! That looks great! :) No super major points of feedback, only some adjustments with spacing and formatting:

It could look like this:

image

2 nice-to-have follow up enhancements:

tcitworld commented 1 year ago

I'd also add a bottom line crediting Thunderbird as the source and explaining the calendar will be downloaded from their servers.

nimishavijay commented 1 year ago

@tcitworld agreed, nice catch! It can be a subline below the heading in --color-maxcontrast :)

ChristophWurst commented 1 year ago

@tcitworld do you recall the magic behind https://framagit.org/framasoft/nextcloud/holiday_calendars/-/blob/66873b114e3dbc42429a5e08fe9eba721d1b5382/src/services/caldavService.js#L83? In Calendar all subscriptions are found as calendars and they have no source property. I need the prop to disable the subscribe button for existing subscriptions. :v:

It's strange how everything ends up in calendars for Calendar using https://github.com/nextcloud/cdav-library/blob/3cf672021e94c52428095775f301812f75a8f397/src/models/calendarHome.js#L88 and your app finding subscriptions with sources with https://github.com/nextcloud/cdav-library/blob/3cf672021e94c52428095775f301812f75a8f397/src/models/calendarHome.js#L120 :exploding_head:

ChristophWurst commented 1 year ago

I noticed you're using 'X-NC-CalDAV-Webcal-Caching': 'Off',

ChristophWurst commented 1 year ago

I'm unable to get unsubscribe handling working. The calendar app fetches subscriptions as calendars. To detect already subscribed holiday calendars we have to fetch subscriptions separately. Mapping that together and keeping it in sync with new or removed subscriptions is not trivial. I'll save that for a follow-up ticket. For now a user can use the modal to subscribe to a holiday calendar. To unsubscribe they have to use the Delete action in the navigation. I say that is good enough.

Edit: created https://github.com/nextcloud/calendar/issues/5168

tcitworld commented 1 year ago

That's right, only subscriptions expose the source property.

Would it be so bothering to refetch subscriptions (as such, with Webcal-Caching off) when opening the holiday modal? Otherwise we can fetch the source property for calendars as well, but that's an overhead. Still, it would also allow copying the source URI from the subscription, which I remember people asking about, but can't find an issue for.

ChristophWurst commented 1 year ago

Would it be so bothering to refetch subscriptions (as such, with Webcal-Caching off) when opening the holiday modal? Otherwise we can fetch the source property for calendars as well, but that's an overhead. Still, it would also allow copying the source URI from the subscription, which I remember people asking about, but can't find an issue for.

We'll have a look when working on https://github.com/nextcloud/calendar/issues/5168!

gelbphoenix commented 1 month ago

Short question: Does the modal need some extra configuration to function?

If yes: What does it need exactly?