+rrex_weekday() {
+ # helper for rrexpand: Nth weekday of a month (e.g. 2nd tuesday, etc.)
+ local nstart nend
+
+ nth=$(( ( $(date -ud @$start +%_d) - 1) / 7))
+
+ nend=$(( 0 * 604800 - (dstart - end) % (rrfreq * 604800) + dstart ))
+ nstart=$(( start - end + nend))
+
+ while [ "$nstart" -lt "$rrend" -a "$nstart" -lt "$dend" ]; do
+ [ "$nstart" -ge "$start" -a "$nstart" -ge "$dstart" ] \
+ && [ "$(( ( $(date -ud @$nstart +%_d) -1) / 7 ))" -eq "$nth" ] \
+ && printf '%i %i %s %s\n' "$nstart" "$nend" "$evtitle" "$evlink"
+ nstart="$((nstart + rrfreq * 7 * 86400))"
+ nend="$((nstart - start + end))"
+ done
+}
+
+rrex_lastweekday() {
+:
+}
+