iCalendar RRULE/RECUR for Thanksgiving weekend? - icalendar

Is there an "easy" way to create yearly events for "Thanksgiving weekend", meaning an event starting on the 4th Thursday of November (with Sunday as the first weekday), and ending on the following Sunday?
As nearly as I can tell, things like RRULE and RECUR let you create recurring events with zero duration (ie, points in time), but not recurring events that last over a period of time.
What am I missing?

RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY:4TH;WKST=SU
You're definitely not restricted to 0 duration events. You can simply specify a DTSTART and DTEND (or DURATION) to get the full weekend.

To elaborate on Evert's answer, to specify a 4 day long event, you just need to specify the DTSTART and DTEND such as below:
DTSTART;VALUE=DATE:20151126 DTEND;VALUE=DATE:20151130 RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=4TH;WKST=SU
the justification comes from below section of RFC5545:
RFC5545 3.6.1The "DTSTART" property for a "VEVENT" specifies the inclusive
start of the event. For recurring events, it also specifies the
very first instance in the recurrence set. The "DTEND" property
for a "VEVENT" calendar component specifies the non-inclusive end
of the event.

Related

ICalendar recurring event starts first day of month, ends last day of month, repeats every month

Using rfc5545 is there a way to represent an event that starts on the first day of each month and ends on the last day of each month and repeats every month?
It's slightly different than a daily repeating event which is not ideal for my use case.
short answer: No
This is driven by the fact that the RFC5545 clearly states that an event cannot have a month duration, only days, weeks or seconds.
3.3.6. Duration
[...] Note that unlike
[ISO.8601.2004], this value type doesn't support the "Y" and "M"
designators to specify durations in terms of years and months.
(emphasis mine)

RRULE 20 days after every 15th in a month,in icalendar (RFC 5545)?

I'm searching a way to express a situation like this in icalendar: an event happens every month, x days after a given date.
e.g.: 20 days after 15th day in every month. so, it might be 3rd, 4th, 5th,6th( like February )
if bymonthday can be set to 35, it's ok.
But in outlook this won't work.
How to solve this question?
You could perhaps try adding ";BYSETPOS=20" to the rule. The specification shows an example of BYSETPOS when using it with BYDAY, but it is not clear to me how it is handled when using BYMONTHDAY. I don't see another option looking at the spec.
http://icalendar.org/iCalendar-RFC-5545/3-3-10-recurrence-rule.html
http://icalendar.org/iCalendar-RFC-5545/3-8-5-3-recurrence-rule.html
Sorry, what you want is not possible with a RRULE.
What you want is RRULE:FREQ=MONTHLY;BYMONTHDAY=35. Unfortunately, it's invalid - BYMONTHDAY can't exceed 31.
BYSETPOS won't work either. In RFC 5545, page 43 under BYSETPOS is the following:
"BYSETPOS operates on a set of recurrence instances in one interval of the recurrence rule."
That means you can't get a value beyond the interval. If you use Monthly you are restricted to the one month.
If you want to experiment with some RRULEs try my recurrence rule (RRULE parser) at
http://balsoftware.net/index.php/open-source/rrule-parser/

How can I exclude DTSTART from generated events if its day not among days specified by BYDAY?

I'm using google-rfc-2445 to generate repeating events according to according to rfc-2445:
The "DTSTART" property for a "VEVENT" specifies the inclusive start of
the event. For recurring events, it also specifies the very first
instance in the recurrence set.
So, for example RRULE for event which occures every Friday 5 times:
DTSTART;TZID=US-Eastern:20160204T090000
RRULE:FREQ=WEEKLY;COUNT=5;BYDAY=FR;INTERVAL=1;
So according to rfc-2445 it will generate 6 events. First event on Thursday 4 February 2016, second event on Friday 5 February 2016, and so on.
How can I achieve that it will exclude first event if it isn't in a pattern? In the example above it should exclude first occurrence, 4 February 2016. In case of defining DTSTART;TZID=US-Eastern:20160205T090000 which is Friday it should leave first occurrence.
Can it be done by defining such "exclusion rule" in RRULE itself or I need to make a check in a code and if DTSTART isn't the same day as defined in BYDAY I should look for closest date in code (manually) and change DTSTART accordingly?
UPDATE
Ok, according to rfc-2445 and this question on google group: https://groups.google.com/forum/#!topic/google-rfc-2445/xqYFe411ysA
The "EXDATE" property can be used to exclude the value specified in
"DTSTART". However, in such cases the original "DTSTART" date MUST
still be maintained by the calendaring and scheduling system because
the original "DTSTART" value has inherent usage dependencies by other
properties such as the "RECURRENCE-ID".
it looks that I need to use EXDATE property to achieve what do I need. Trying to achieve this by following RRULE:
EXDATE;TZID=Asia/Jerusalem:20160210T000000
RRULE:FREQ=WEEKLY;COUNT=5;BYDAY=WE;INTERVAL=1;
And start date is: 2016-02-10T00:00:00.000+02:00 in the following code:
DateTimeIterable dti = DateTimeIteratorFactory.createDateTimeIterable(RRULE, DTSTART, dateTimeZone, true);
But it returns only 4 events, so it always remove first event.
From the description of the problem you give, you will get 6 events when DTSTART is added and you would not want it to be part of the list of instances and 5 events when it is a good date.
So what you want is to only get the last 5 events, which is possible by using the BYSETPOS in your RRULE, the following should do the trick:
BYSETPOS=-5,-4,-3,-2,-1
which will return in all cases the last 5 events that your RRULE gives regardless if the DTSTART is matching the pattern of your RRULE or not.

how to set event duration in ekevent in icalender?

I created event in iCalendar. Its start date is today and end date is next month 15th. and this is recurrence type of event . so if set event as recurrence event then changed end date as same as recurrence end date. I want to give time duration of event,like 3.30P.M to 6.30P.M. How to i set event duration ....
"DTSTART;TZID=US-Eastern:19970105T083000
RRULE:FREQ=YEARLY;INTERVAL=2;BYMONTH=1;BYDAY=SU;BYHOUR=8,9; BYMINUTE=30
First, the "INTERVAL=2" would be applied to "FREQ=YEARLY" to arrive at "every other year".
Then, "BYMONTH=1" would be applied to arrive at "every January, every other year".
Then, "BYDAY=SU" would be applied to arrive at "every Sunday in January, every other year".
Then, "BYHOUR=8,9" would be applied to arrive at "every Sunday in January at 8 AM and 9 AM, every other year".
Then, "BYMINUTE=30" would be applied to arrive at "every Sunday in January at 8:30 AM and 9:30 AM, every other year".
Then, lacking information from RRULE, the second is derived from DTSTART, to end up in "every Sunday in January at 8:30:00 AM and 9:30:00 AM, every other year".
Similarly, if the BYMINUTE, BYHOUR, BYDAY, BYMONTHDAY or BYMONTH rule part were missing, the appropriate minute, hour, day or month would have been retrieved from the "DTSTART" property."
Please any one guide me how to set ...
I know how to recurrence rule is working but my question is how to set event duration.
No client that I know of support BYMINUTE and BYHOUR so unless this event is for your own application consumption, you are asking for trouble. IN any case, the very first instance will use the DTSTART value as the beginning, regardless of what you may have put in BYMINUTE and BYHOUR (see https://www.rfc-editor.org/rfc/rfc5545#section-3.8.5.3)
Then you can use DTEND or DURATION:
DTSTART;TZID=US-Eastern:19970105T083000
DTEND;TZID=US-Eastern:19970105T153000
or
DTSTART;TZID=US-Eastern:19970105T083000
DURATION:PT7H

iCalendar (RFC5545) recurrence rule multiple times a day

How can I make an event occur multiple times a day using the RRULE specified in RFC5545?
Lets say I would like an event to happen every other week on Monday and Friday at 11AM and 18PM. Is it possible to format the RRULE like something as the following:
RRULE:FREQ=WEEKLY;INTERVAL=2;BYDAY=MO,FR;[TIMES=110000,180000]
Thanks
you have to use the byhour
The BYHOUR rule part specifies a COMMA-
separated list of hours of the day. Valid values are 0 to 23.
so that would be :
RRULE:FREQ=WEEKLY;INTERVAL=2;BYDAY=MO,FR;BYHOUR=11,18