I'm currently using iCalendar specification (RFC 5545) to deal with recurring events.
Until yesterday, their recurrence rules covered all my needs, but now I'm having a hard time implementing the following rule:
Every month on the first Monday OR Wednesday of the month.
Ex:
Is there a way to define this kind of "conditional" rule?
If I understand the requirement correctly, it is not exactly conditional. It is that ONLY the first of the first Monday and first Wednesday is required. BYSETPOS is aimed at this.
In this example, it is being used to calculate the last working day https://icalevents.com/2555-paydays-last-working-days-and-why-bysetpos-is-useful/
For your example
RRULE:FREQ=MONTHLY;BYDAY=1MO,1WE;BYSETPOS=1
should do the trick,
Basically the RRULE will expand out all the first MONDAY and WEDNESDAYs and then 'contract' ie take the first date of each pair.
Page 43 of the specification https://www.ietf.org/rfc/rfc5545.txt shows the priorities of the 'expansions' and 'contractions'.