{"id":13463383,"url":"https://github.com/icalendar/icalendar","last_synced_at":"2025-05-11T03:46:22.232Z","repository":{"id":472278,"uuid":"97322","full_name":"icalendar/icalendar","owner":"icalendar","description":"icalendar.rb main repository","archived":false,"fork":false,"pushed_at":"2025-04-12T16:44:25.000Z","size":914,"stargazers_count":1175,"open_issues_count":17,"forks_count":189,"subscribers_count":24,"default_branch":"main","last_synced_at":"2025-05-08T01:00:03.448Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/icalendar.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2008-12-28T00:05:21.000Z","updated_at":"2025-05-02T08:44:38.000Z","dependencies_parsed_at":"2023-07-05T15:03:34.437Z","dependency_job_id":"e9fc4730-66fd-43eb-bbfd-ba3069bfa2d1","html_url":"https://github.com/icalendar/icalendar","commit_stats":{"total_commits":398,"total_committers":77,"mean_commits":"5.1688311688311686","dds":0.7311557788944724,"last_synced_commit":"515b5cb5a03d865fde3796a70a50252eda708843"},"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icalendar%2Ficalendar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icalendar%2Ficalendar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icalendar%2Ficalendar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icalendar%2Ficalendar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icalendar","download_url":"https://codeload.github.com/icalendar/icalendar/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252978754,"owners_count":21834915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T13:00:52.447Z","updated_at":"2025-05-08T01:00:26.423Z","avatar_url":"https://github.com/icalendar.png","language":"Ruby","readme":"iCalendar -- Internet calendaring, Ruby style\n===\n\n[![Ruby](https://github.com/icalendar/icalendar/actions/workflows/main.yml/badge.svg)](https://github.com/icalendar/icalendar/actions/workflows/main.yml)\n[![Code Climate](https://codeclimate.com/github/icalendar/icalendar.png)](https://codeclimate.com/github/icalendar/icalendar)\n\n\u003chttp://github.com/icalendar/icalendar\u003e\n\n### Upgrade from 1.x ###\n\nBetter documentation is still to come, but in the meantime the changes needed to move from 1.x to 2.0 are summarized by the [diff needed to update the README](https://github.com/icalendar/icalendar/commit/bc3701e004c915a250054030a9375d1e7618857f)\n\nDESCRIPTION\n---\n\niCalendar is a Ruby library for dealing with iCalendar files in the\niCalendar format defined by [RFC-5545](http://tools.ietf.org/html/rfc5545).\n\nEXAMPLES\n---\n\n### Creating calendars and events ###\n\n```ruby\nrequire 'icalendar'\n\n# Create a calendar with an event (standard method)\ncal = Icalendar::Calendar.new\ncal.event do |e|\n  e.dtstart     = Icalendar::Values::Date.new('20050428')\n  e.dtend       = Icalendar::Values::Date.new('20050429')\n  e.summary     = \"Meeting with the man.\"\n  e.description = \"Have a long lunch meeting and decide nothing...\"\n  e.ip_class    = \"PRIVATE\"\nend\n\ncal.publish\n```\n\n#### Or you can make events like this ####\n\n```ruby\nevent = Icalendar::Event.new\nevent.dtstart = DateTime.civil(2006, 6, 23, 8, 30)\nevent.summary = \"A great event!\"\ncal.add_event(event)\n\nevent2 = cal.event  # This automatically adds the event to the calendar\nevent2.dtstart = DateTime.civil(2006, 6, 24, 8, 30)\nevent2.summary = \"Another great event!\"\n```\n\n#### Support for property parameters ####\n\n```ruby\nparams = {\"altrep\" =\u003e \"http://my.language.net\", \"language\" =\u003e \"SPANISH\"}\n\nevent = cal.event do |e|\n  e.dtstart = Icalendar::Values::Date.new('20050428')\n  e.dtend   = Icalendar::Values::Date.new('20050429')\n  e.summary = Icalendar::Values::Text.new \"This is a summary with params.\", params\nend\nevent.summary.ical_params #=\u003e {'altrep' =\u003e 'http://my.language.net', 'language' =\u003e 'SPANISH'}\n\n# or\n\nevent = cal.event do |e|\n  e.dtstart = Icalendar::Values::Date.new('20050428')\n  e.dtend   = Icalendar::Values::Date.new('20050429')\n  e.summary = \"This is a summary with params.\"\n  e.summary.ical_params = params\nend\nevent.summary.ical_params #=\u003e {'altrep' =\u003e 'http://my.language.net', 'language' =\u003e 'SPANISH'}\n```\n\n#### Support for Dates or DateTimes\n\nSometimes we don't care if an event's start or end are `Date` or `DateTime` objects. For this, we can use `DateOrDateTime.new(value)`. Calling `.call` on the returned `DateOrDateTime` will immediately return the underlying `Date` or `DateTime` object.\n\n```ruby\nevent = cal.event do |e|\n  e.dtstart = Icalendar::Values::DateOrDateTime.new('20140924')\n  e.dtend   = Icalendar::Values::DateOrDateTime.new('20140925').call\n  e.summary = 'This is an all-day event, because DateOrDateTime will return Dates'\nend\n```\n\n#### Support for URLs\n\nFor clients that can parse and display a URL associated with an event, it's possible to assign one.\n\n```ruby\nevent = cal.event do |e|\n  e.url = 'https://example.com'\nend\n```\n\n#### We can output the calendar as a string ####\n\n    cal_string = cal.to_ical\n    puts cal_string\n\nALARMS\n---\n\n### Within an event ###\n\n```ruby\ncal.event do |e|\n  # ...other event properties\n  e.alarm do |a|\n    a.action          = \"EMAIL\"\n    a.description     = \"This is an event reminder\" # email body (required)\n    a.summary         = \"Alarm notification\"        # email subject (required)\n    a.attendee        = %w(mailto:me@my-domain.com mailto:me-too@my-domain.com) # one or more email recipients (required)\n    a.append_attendee \"mailto:me-three@my-domain.com\"\n    a.trigger         = \"-PT15M\" # 15 minutes before\n    a.append_attach   Icalendar::Values::Uri.new(\"ftp://host.com/novo-procs/felizano.exe\", \"fmttype\" =\u003e \"application/binary\") # email attachments (optional)\n  end\n\n  e.alarm do |a|\n    a.action  = \"DISPLAY\" # This line isn't necessary, it's the default\n    a.summary = \"Alarm notification\"\n    a.trigger = \"-P1DT0H0M0S\" # 1 day before\n  end\n\n  e.alarm do |a|\n    a.action        = \"AUDIO\"\n    a.trigger       = \"-PT15M\"\n    a.append_attach \"Basso\"\n  end\nend\n```\n\n#### Output ####\n\n    # BEGIN:VALARM\n    # ACTION:EMAIL\n    # ATTACH;FMTTYPE=application/binary:ftp://host.com/novo-procs/felizano.exe\n    # TRIGGER:-PT15M\n    # SUMMARY:Alarm notification\n    # DESCRIPTION:This is an event reminder\n    # ATTENDEE:mailto:me-too@my-domain.com\n    # ATTENDEE:mailto:me-three@my-domain.com\n    # END:VALARM\n    #\n    # BEGIN:VALARM\n    # ACTION:DISPLAY\n    # TRIGGER:-P1DT0H0M0S\n    # SUMMARY:Alarm notification\n    # END:VALARM\n    #\n    # BEGIN:VALARM\n    # ACTION:AUDIO\n    # ATTACH;VALUE=URI:Basso\n    # TRIGGER:-PT15M\n    # END:VALARM\n\n#### Checking for an Alarm ####\n\nCalling the `event.alarm` method will create an alarm if one doesn't exist. To check if an event has an alarm use the `has_alarm?` method.\n\n```ruby\nevent.has_alarm?\n# =\u003e false\n\nevent.alarm\n# =\u003e #\u003cIcalendar::Alarm ... \u003e\n\nevent.has_alarm?\n#=\u003e true\n```\n\nTIMEZONES\n---\n\n```ruby\ncal = Icalendar::Calendar.new\ncal.timezone do |t|\n  t.tzid = \"America/Chicago\"\n\n  t.daylight do |d|\n    d.tzoffsetfrom = \"-0600\"\n    d.tzoffsetto   = \"-0500\"\n    d.tzname       = \"CDT\"\n    d.dtstart      = \"19700308T020000\"\n    d.rrule        = \"FREQ=YEARLY;BYMONTH=3;BYDAY=2SU\"\n  end\n\n  t.standard do |s|\n    s.tzoffsetfrom = \"-0500\"\n    s.tzoffsetto   = \"-0600\"\n    s.tzname       = \"CST\"\n    s.dtstart      = \"19701101T020000\"\n    s.rrule        = \"FREQ=YEARLY;BYMONTH=11;BYDAY=1SU\"\n  end\nend\n```\n\n#### Output ####\n\n    # BEGIN:VTIMEZONE\n    # TZID:America/Chicago\n    # BEGIN:DAYLIGHT\n    # TZOFFSETFROM:-0600\n    # TZOFFSETTO:-0500\n    # TZNAME:CDT\n    # DTSTART:19700308T020000\n    # RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU\n    # END:DAYLIGHT\n    # BEGIN:STANDARD\n    # TZOFFSETFROM:-0500\n    # TZOFFSETTO:-0600\n    # TZNAME:CST\n    # DTSTART:19701101T020000\n    # RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU\n    # END:STANDARD\n    # END:VTIMEZONE\n\niCalendar has some basic support for creating VTIMEZONE blocks from timezone information pulled from `tzinfo`.\nYou must require `tzinfo` support manually to take advantage.\n\niCalendar has been tested and works with `tzinfo` versions 0.3, 1.x, and 2.x. The `tzinfo-data` gem may also\nbe required depending on your version of `tzinfo` and potentially your operating system.\n\n#### Example ####\n\n```ruby\nrequire 'icalendar/tzinfo'\n\ncal = Icalendar::Calendar.new\n\nevent_start = DateTime.new 2008, 12, 29, 8, 0, 0\nevent_end = DateTime.new 2008, 12, 29, 11, 0, 0\n\ntzid = \"America/Chicago\"\ntz = TZInfo::Timezone.get tzid\ntimezone = tz.ical_timezone event_start\ncal.add_timezone timezone\n\ncal.event do |e|\n  e.dtstart = Icalendar::Values::DateTime.new event_start, 'tzid' =\u003e tzid\n  e.dtend   = Icalendar::Values::DateTime.new event_end, 'tzid' =\u003e tzid\n  e.summary = \"Meeting with the man.\"\n  e.description = \"Have a long lunch meeting and decide nothing...\"\n  e.organizer = \"mailto:jsmith@example.com\"\n  e.organizer = Icalendar::Values::CalAddress.new(\"mailto:jsmith@example.com\", cn: 'John Smith')\nend\n```\n\n\nParsing iCalendars\n---\n\n```ruby\n# Open a file or pass a string to the parser\ncal_file = File.open(\"single_event.ics\")\n\n# Parser returns an array of calendars because a single file\n# can have multiple calendars.\ncals = Icalendar::Calendar.parse(cal_file)\ncal = cals.first\n\n# Now you can access the cal object in just the same way I created it\nevent = cal.events.first\n\nputs \"start date-time: #{event.dtstart}\"\nputs \"start date-time timezone: #{event.dtstart.ical_params['tzid']}\"\nputs \"summary: #{event.summary}\"\n```\n\nYou can also create a `Parser` instance directly, this can be used to enable\nstrict parsing:\n\n```ruby\n# Sometimes you want to strongly verify only rfc-approved properties are\n# used\nstrict_parser = Icalendar::Parser.new(cal_file, true)\ncal = strict_parser.parse\n```\n\nParsing Components (e.g. Events)\n---\n\n```ruby\n# Open a file or pass a string to the parser\nevent_file = File.open(\"event.ics\")\n\n# Parser returns an array of events because a single file\n# can have multiple events.\nevents = Icalendar::Event.parse(event_file)\nevent = events.first\n\nputs \"start date-time: #{event.dtstart}\"\nputs \"start date-time timezone: #{event.dtstart.ical_params['tzid']}\"\nputs \"summary: #{event.summary}\"\n```\n\nFinders\n---\n\nOften times in web apps and other interactive applications you'll need to\nlookup items in a calendar to make changes or get details.  Now you can find\neverything by the unique id automatically associated with all components.\n\n```ruby\ncal = Calendar.new\n10.times { cal.event } # Create 10 events with only default data.\nsome_event = cal.events[5] # Grab it from the array of events\n\n# Use the uid as the key in your app\nkey = some_event.uid\n\n# so later you can find it.\nsame_event = cal.find_event(key)\n```\n\nExamples\n---\n\nCheck the unit tests for examples of most things you'll want to do, but please\nsend me example code or let me know what's missing.\n\nDownload\n---\n\nThe latest release version of this library can be found at\n\n* \u003chttp://rubygems.org/gems/icalendar\u003e\n\nInstallation\n---\n\nIt's all about rubygems:\n\n    $ gem install icalendar\n\nTesting\n---\n\nTo run the tests:\n\n    $ bundle install\n    $ rake spec\n\nLicense\n---\n\nThis library is released under the same license as Ruby itself.\n\n\nSupport \u0026 Contributions\n---\n\nPlease submit pull requests from a rebased topic branch and\ninclude tests for all bugs and features.\n\nContributor Code of Conduct\n---\n\nAs contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.\n\nWe are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.\n\nExamples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.\n\nProject maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.\n\nThis code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.\n\nInstances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.\n\nThis Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.1.0, available at [http://contributor-covenant.org/version/1/1/0/](http://contributor-covenant.org/version/1/1/0/)\n","funding_links":[],"categories":["Time \u0026 Space","Ruby","1. language"],"sub_categories":["Calendars","1.1 ruby"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficalendar%2Ficalendar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficalendar%2Ficalendar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficalendar%2Ficalendar/lists"}