在每年六月的第三个星期一之后写周二的最佳方法是什么?
目前我写这样的规则:
rule_mo = rrule(freq=YEARLY,
bymonth=6,
byweekday=MO(+3),
...)
rule = (x + relativedelta(weekday=TU(+1)) for x in rule_mo)
有没有办法只使用rrule
编写整个规则,而不必使用relativedelta
的第二遍?
答案 0 :(得分:3)
参考:http://jkbr.github.io/rrule/
rule = RRule.fromText("every June on 3rd Tuesday")
rule.origOptions
{
freq: RRule.YEARLY,
bymonth: [6],
byweekday: [RRule.TU.nth(3)]
}
rule.toString()
FREQ=YEARLY;BYMONTH=6;BYDAY=+3TU
rule.toText() every June on the 3rd Tuesday