双月支付期的 iCal 合规重复规则
iCal compliant recurrence rule for bimonthly pay period
我正在尝试创建一个符合 iCal 的重复规则,它应该反映双月领薪的人的发薪日。可以在 RFC.
上找到重复规则的详细信息
规则如下:
- 个人在每月的 15 号和最后一天收到工资。
- 如果该月的 15 号或最后一天是周末,他们应该在之前的星期五收到付款。
我目前拥有的:
[
"RRULE:FREQ=MONTHLY;BYMONTHDAY=15;BYDAY=MO,TU,WE,TH,FR", // this will select the 15th if it's not on a weekend
"RRULE:FREQ=MONTHLY;BYSETPOS=-1;BYDAY=MO,TU,WE,TH,FR;", // this correctly selects the last weekday of the month
]
这种方法的问题是,如果 15 日是周末,则该事件将被忽略。
我不确定这是否可以建模。任何帮助将不胜感激。
这 discussion 解决了问题。
对于第 15 个,我需要以下规则:
RRULE:FREQ=MONTHLY;INTERVAL=1;BYSETPOS=-1;BYMONTHDAY=13,14,15;BYDAY=MO,TU,WE,TH,FR
So thats the last weekday before the 15. I had to add the 13,14,15 since those are esentially the only possible dates that I can occur. (Worst case would be that the 15th is Sunday, so the preceding Friday would be the 13th
两条规则合在一起让我得到了我需要的东西!
我正在尝试创建一个符合 iCal 的重复规则,它应该反映双月领薪的人的发薪日。可以在 RFC.
上找到重复规则的详细信息规则如下:
- 个人在每月的 15 号和最后一天收到工资。
- 如果该月的 15 号或最后一天是周末,他们应该在之前的星期五收到付款。
我目前拥有的:
[
"RRULE:FREQ=MONTHLY;BYMONTHDAY=15;BYDAY=MO,TU,WE,TH,FR", // this will select the 15th if it's not on a weekend
"RRULE:FREQ=MONTHLY;BYSETPOS=-1;BYDAY=MO,TU,WE,TH,FR;", // this correctly selects the last weekday of the month
]
这种方法的问题是,如果 15 日是周末,则该事件将被忽略。
我不确定这是否可以建模。任何帮助将不胜感激。
这 discussion 解决了问题。
对于第 15 个,我需要以下规则:
RRULE:FREQ=MONTHLY;INTERVAL=1;BYSETPOS=-1;BYMONTHDAY=13,14,15;BYDAY=MO,TU,WE,TH,FR
So thats the last weekday before the 15. I had to add the 13,14,15 since those are esentially the only possible dates that I can occur. (Worst case would be that the 15th is Sunday, so the preceding Friday would be the 13th
两条规则合在一起让我得到了我需要的东西!