-
Notifications
You must be signed in to change notification settings - Fork 486
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
Add iCalendar export support #2261
base: dev
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #2261 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 196 200 +4
Lines 11935 12158 +223
Branches 1722 1732 +10
==========================================
+ Hits 11935 12158 +223 ☔ View full report in Codecov by Sentry. |
I think it would be better to use the built-in Holidays l10n instead of creating something specific for iCal. |
@KJhellico |
|
|
||
|
||
class ICalExporter: | ||
def __init__(self, holidays_object, language="en", return_bytes=False): |
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.
Now language
parameter is not needed.
""" | ||
yield "BEGIN:VCALENDAR" | ||
yield "VERSION:2.0" | ||
yield "PRODID:-//holidays Framework//NONSGML v1.9//EN" |
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.
We can get actual language from self.holidays.language
.
yield "VERSION:2.0" | ||
yield "PRODID:-//holidays Framework//NONSGML v1.9//EN" | ||
|
||
for date, name in self.holidays.items(): |
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.
Remember:
- one date can have multiple holidays
- iCal has a limited line length
Proposed change
This PR introduces a new iCalendar export functionality to the holidays library. The implementation includes:
ICalExporter
class for converting holiday data to iCalendar formatThe exporter follows RFC 5545 specifications for iCalendar format, allowing users to easily export their holiday data to calendar applications.
Example usage:
Resolves #2179
Type of change
holidays
functionality in general)Checklist
make check
, all checks and tests are green