How to update a recurrence occurence on ICal - icalendar

I'm currently working with the ical format and need to handle recurring events.
I'm working directly with Icloud and have managed to create and delete recurring events.
However, I encountered some problems when trying to update a single occurence of the said recurrence.
For example, let's say I have an event called 'test' scheduled every day for a week.
How should I proceed to rename the occurence of Tuesday to 'other title'? Or even change the dates for this particular occurrence ?
I tried to simply update the occurence by using it's ID but it seems to create a clone of it and not touch the real occurence. Moreover when trying to access the cloned event from the Icloud calendar interface it crashes.
So I'm a bit stuck and would appreciate some help :)
Thanks a lot,

It is not totally clear whether you are trying to update the occurence.
In any case, you should still have only one calendar resource but it should contain
one "master" VEVENT, containing the base information,along with the RRULE,
one VEVENT for each instance that is an "exception" to the base event, where each exception is identified by its RECURRENCE-ID.
RFC5545 does not have any example of such event but RFC5546 has something pretty close at https://www.rfc-editor.org/rfc/rfc5546#section-4.4.8 (using RDATE instead of RRULE and no need for the METHOD property but you get the idea).

Posting for future readers. For some reasons it's super hard to find a working example of RECURRENCE-ID
The following resource will repeat an event 'test' (10AM - 1PM UTC) everyday for 10 days starting on Jan 13th, 2021, EXCEPT on Jan 15th 2021, the event will be called 'test except me' and starts 3PM - 6PM UTC.
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
UID:232392939239293293#hello.me
DTSTART:20210113T100000Z
DTEND:20210113T130000Z
SUMMARY:test
RRULE:FREQ=DAILY;INTERVAL=1;COUNT=10
END:VEVENT
BEGIN:VEVENT
UID:232392939239293293#hello.me
DTSTART:20210115T150000Z
DTEND:20210115T180000Z
SUMMARY:test except me
RECURRENCE-ID;VALUE=DATE-TIME:20210115T100000Z
END:VEVENT
END:VCALENDAR

Related

Why are my times screwed up on some devices but fine on others?

I have an icalendar I generate via PHP so people can download the latest schedule to their phones. It works great except that the game times are off by 6 hours on my iPhone. The game time is perfectly fine displaying on Windows calendar.
I've tried playing with the timezones and times but cannot get them to be equal on all platforms.
The calendar is viewable at:
webcal://cal.outbackthunder.com
Dawson,
your ics file at http://cal.outbackthunder.com has the event dates specified in 'local' or 'floating' times.
So the importing app will probably make the events be that time in it's timezone. 8am is 8am in all timezones (think of a travellers alarm clock - where they want to wake at 8m no matter the timezone they are in, vs a reminder to call their partner at 8am in the home timezone, where they'd then want it to adjust to the traveling timezone.)
Either add a Z and issue date-times in UTC, or add the TZID identifer of the timezone.
See https://www.rfc-editor.org/rfc/rfc5545#section-3.3.5.
See these examples in the spec:
Example: The following represents July 14, 1997, at 1:30 PM in New
York City in each of the three time formats, using the "DTSTART"
property.
DTSTART:19970714T133000 ; Local time
DTSTART:19970714T173000Z ; UTC time
DTSTART;TZID=America/New_York:19970714T133000
; Local time and time
; zone reference
Also try running your ics file through as many validators as you can find if you want the general public to be able to use the url. They tend to report slightly differently. EG: one says of http://cal.outbackthunder.com
DATE-TIME value in [DTSTAMP] must be specified in UTC time
Property [ORGANIZER] must be specified once

Recurring exceptions in ICal

Problem
Some reoccurring events, that don't really end at some point (like club meetings?), depend on other conditions (like holiday season). However, manually adding these exceptions would be necessary every year, as the dates might differ.
Research
I have found out about exdate (see the image of "iCalendar components and their properties" on Wikipedia (2))
Also found some possible workaround: 'just writing a script to do process such events'. This would still mean I need to process a .ics manually and import it into my calendar, which implies some limitations:
can not be determined for all time spans (e.g. holidays not fixed for more than three years)
these events would probably be separate and not reoccurring/'grouped', which makes further edits harder
Question
Is there a way to specify recurring exceptions in iCal ?
To clarify, I have a recurring event and recurring exceptions.
So for instance I have a infinitely reoccurring weekly event, that depends on the month; where it might only take place if it's not e.g. January, August, or December.
Is there a way to use another event (/calendar) to filter events by boolean logic ?
If one could use a second event (or several) to plug into exdate this would solve the first problem and add some more possibilities.
note
if this question is too specific and the original problem could be solved by other means (other calendar-formats), feel free to comment/edit/answer
RFC2445 defines an EXRULE (exception rule) property. You can use that in addition to the RRULE to define recurring exceptions.
However, RFC2445 was superseded by RFC5545, which unfortunately deprecates the EXRULE property. So, client support is questionable.
As you already proposed, automatically adding EXDATE properties is a possible solution.
BYMONTH would be another possibility, e.g. here's a rule for a club meeting that occurs the first Wednesday of every month except December (which is their Christmas party, so no business meeting)
RRULE:FREQ=MONTHLY;BYDAY=1WE;BYMONTH=1,2,3,4,5,6,7,8,9,10,11

iCalendar file creates multiple entries per day

I have script that creates a ICS file (iCalender ) which is later consumed by a mobile device .
if the event is set to repeat daily withing two dates, the file produces 7 entries per day.
I can reproduce the problem with the file below, simply by importing it to Google calendar (by attaching it to an email, sending it to my gmail account and pressing add to calendar)
but I have no idea why it will creates multiple entries , I tried tweaking with some of the entries, only to end up with an invalid file
here is my test file
BEGIN:VCALENDAR
PRODID:-//Test Productions //Test Event//EN
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
SUMMARY:Test Event
DESCRIPTION:Description of Test Event
DTSTART:20140825T100000Z
DTEND:20140831T110000Z
RRULE:FREQ=DAILY;UNTIL=20141231T060000Z
LOCATION:Planer Earth
CLASS:PUBLIC
BEGIN:VALARM
TRIGGER:-PT1H
ACTION:EMAIL
END:VALARM
END:VEVENT
END:VCALENDAR
The problem actually was that the duration was several days and 1 hour (probably you only wanted 1 hour?)
DTSTART:201408**25**T100000Z
DTEND:201408**31**T110000Z
so after a few days you would have had several of these events running concurrently until they started ending ... until the last recurrence of the last one, only one event would have been running.
Stumbled on the aswer:
if you specify RRULE:FREQ=DAILY;UNTIL=20141231T060000Z
you should not include DTEND:20140831T110000Z entry

Express alternative recurring times in iCalendar

Is there a way to express the following in iCalendar? (possibly using RRULEs?)
Between 9am and 5pm every day except Sundays when it is between 10am and 4pm.
Can I create multiple RRULEs? Which ones have precedence?
iCalendar does not have a notion of events with a hole in the middle of the duration. So even without talking about recurring event, you can not create with a single event something like from 9AM to 10AM and from 4PM to 5 PM
As a consequence, you need to actually create 3 events:
DTSTART:2013xxxxT090000
DURATION:PT1H
RRULE:FREQ=DAILY
DTSTART:2013xxxxT100000
DURATION:PT6H
RRULE:FREQ=DAILY;BYDAY=MO,TU,WE,TH,FR,SA
DTSTART:2013xxxxT160000
DURATION:PT1H
RRULE:FREQ=DAILY
As far as having multiple RRULE, this was supported in RFC2445 but it has been deprecated in RFC5545 (just like EXRULE) due to lack of support and complexity.

iCalendar Format (Outlook 2007)

I've got a little problem, I need to be able to have a reoccurring event (forever) that marks the day after the second Tuesday of each month.
Your probably thinking, why not just Wednesday of each month.
October 2008 is an example, it starts on a Wednesday. :(
Really I just need it in Outlook, probably (but not limited to) some iCalendar format file.
The following iCalendar rule should work:
RRULE:FREQ=MONTHLY;BYDAY=WE;BYMONTHDAY=9,10,11,12,13,14,15
It should be read as "The first Wednesday of every month that falls on the 9th or later".
Edit: To use, create a calendar with a recurring event and export it to .ics. Open the ics file, find the existing RRULE, replace it with this one and import the ics back into outlook.