本月第一天重复发生的日历活动

时间:2016-07-03 13:59:13

标签: icalendar rrule

我每个月的第1天都会有一个重复的日历活动,当第一个是星期六/星期日时,iCal可以安排在最后一个工作日周五吗?

2 个答案:

答案 0 :(得分:1)

如果我理解正确,以下RRULE应该可以解决问题:

FREQ=MONTHLY;BYDAY=1MO,1TU,1WE,1TH,1FR,-1FR;BYMONTHDAY=1,-1,-2

请参阅next 100 instances

它基本上做了两件事:

  1. 迭代当月第一天的第一个工作日
  2. 迭代每个月的最后一个星期五,即该月的最后一天或倒数第二天(下个月的第一天是星期六或星期日)。
  3. 应该产生相同结果的稍短的版本是

    FREQ=MONTHLY;BYDAY=1MO,1TU,1WE,1TH,FR;BYMONTHDAY=1,-1,-2
    

    这只是每个星期五重复,但只保留每个月的第一天,最后一天和倒数第二天的那些。虽然看起来上面的递归扩展服务不一致。这可能是一个错误。

答案 1 :(得分:0)

I'm assuming you mean "the last working day Friday of the previous month", in which case I don't think it possible. It would mean that some months have 2 occurrences when others have 0, which doesn't really work.

You could easily do the first working day of the month (the 1st, or the first Monday):

FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=1

Or, you could do always the last working day of the month:

FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1