Skip to content
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

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft

Conversation

kawazap
Copy link

@kawazap kawazap commented Feb 1, 2025

Proposed change

This PR introduces a new iCalendar export functionality to the holidays library. The implementation includes:

  • New ICalExporter class for converting holiday data to iCalendar format
  • Support for basic iCalendar properties (VCALENDAR, VEVENT)
  • Preparation for multi-language support through language parameter
  • Test coverage for basic calendar structure and event generation

The exporter follows RFC 5545 specifications for iCalendar format, allowing users to easily export their holiday data to calendar applications.

Example usage:

from holidays import US
from holidays.ical import ICalExporter

us_holidays = US(years=2024)
exporter = ICalExporter(us_holidays)
ical_content = "\n".join(exporter.generate())

Resolves #2179

Type of change

  • New country/market holidays support (thank you!)
  • Supported country/market holidays update (calendar discrepancy fix, localization)
  • Existing code/documentation/test/process quality improvement (best practice, cleanup, refactoring, optimization)
  • Dependency update (version deprecation/pin/upgrade)
  • Bugfix (non-breaking change which fixes an issue)
  • Breaking change (a code change causing existing functionality to break)
  • New feature (new holidays functionality in general)

Checklist

@github-actions github-actions bot added the test label Feb 1, 2025
Copy link

sonarqubecloud bot commented Feb 1, 2025

Copy link

codecov bot commented Feb 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (4526e2a) to head (a24717a).
Report is 2 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##               dev     #2261    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files          196       200     +4     
  Lines        11935     12150   +215     
  Branches      1722      1732    +10     
==========================================
+ Hits         11935     12150   +215     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@KJhellico
Copy link
Collaborator

Preparation for multi-language support through language parameter

I think it would be better to use the built-in Holidays l10n instead of creating something specific for iCal.

@kawazap
Copy link
Author

kawazap commented Feb 3, 2025

@KJhellico
Thank you for your review. you're absolutely right about using the built-in Holidays l10n system.
I am on TODO regarding it and will be implementing it later!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement iCal data export
2 participants