- EE 2.10.1
- SolSpace Calendar 1.8.14
If I have an event on the 2nd and 4th Wednesdays of every month, how can I programmatically convey that recurrence rule in plain English? I know Calendar provides the {rules}...{/rules}
tags inside {exp:calendar:events}
, but the variables provided therein don't convert to English very easily.
Here's what I've come up with so far. It's not comprehensive by any means, as all it does is convey the specific recurrence rule I mentioned earlier in English—it's not flexible enough to handle many variations (it doesn't account for if a new rule is an exclusion, it assumes recurrence is monthly, etc).
<p>Schedule:
<ul>
{rules}
<li>
{rule_relative_dow backspace="2"}
{if "{relative_dow}"}
{relative_dow}<sup>{if "{relative_dow}" == 1}st
{if:elseif "{relative_dow}" == 2}nd
{if:elseif "{relative_dow}" == 3}rd
{if:elseif "{relative_dow}"}th
{/if}</sup>
{/if} &{/rule_relative_dow}
{rule_days_of_week backspace="2"}{day_of_week}, {/rule_days_of_week}
of every {if "{rule_repeat_months}" > 1}{rule_repeat_months} months{if:else}month{/if}
</li>
{/rules}
</ul>
</p>
I feel like there should be a more concise way to do this...