python - 如何为 Google Calendar API 制定自定义重复规则?
问题描述
我正在开发一个项目,我必须在 Google 日历中为最终用户安排一些重复性事件。我一直在使用日历的 Python API,到目前为止,根据 RFC 5545 标准使用最常见的循环规则我没有遇到任何问题。
但是,在没有模式的情况下安排重复事件会很有帮助。我的意思是,我不想告诉谷歌在周五每周安排 3 次,而是想指定此类事件的日期,并将它们全部注册在同一个事件 ID 下。
有谁知道这是否可能?任何评论将不胜感激!
解决方案
这是可能的,但不是很容易。您提到的标准在此处实际描述了这一点:链接到标准页面 120。
The recurrence dates, if specified, are used in computing the
recurrence set. The recurrence set is the complete set of
recurrence instances for a calendar component. The recurrence set
is generated by considering the initial "DTSTART" property along
with the "RRULE", "RDATE", and "EXDATE" properties contained
within the recurring component. The "DTSTART" property defines
the first instance in the recurrence set. The "DTSTART" property
value SHOULD match the pattern of the recurrence rule, if
specified. The recurrence set generated with a "DTSTART" property
value that doesn't match the pattern of the rule is undefined.
The final recurrence set is generated by gathering all of the
start DATE-TIME values generated by any of the specified "RRULE"
and "RDATE" properties, and then excluding any start DATE-TIME
values specified by "EXDATE" properties. This implies that start
DATE-TIME values specified by "EXDATE" properties take precedence
over those specified by inclusion properties (i.e., "RDATE" and
"RRULE"). Where duplicate instances are generated by the "RRULE"
and "RDATE" properties, only one recurrence is considered.
Duplicate instances are ignored.
这意味着您可以有一个开始日期 ( DTSTART
) 和一个重复规则 ( RRULE
)。通过使用EXDATE
,您可以创建一个 RRULE 表示“从 STARTDATE 到 ENDDATE 的每一天,除了 [您不想要的所有时间列表]”。这仅适用于每天,您不能按照标准每小时开会。
推荐阅读
- cassandra - 针对特定版本的 Cassandra 运行查询
- sql - 如何在存储过程中将一个 CLOB 输出用作另一个 CLOB 中的列?
- sql - 在 Oracle SELECT 查询中,如何更改特定条目的描述?
- javascript - React redux - 将新项目推送到状态数组不起作用
- reinforcement-learning - 设置 config["dueling"]=False 仍然运行 Dueling DQN
- node.js - 节点 api 路由不返回任何状态码
- python - 为什么 `lambda: MyClass()` 是合法的,但 `MyClass()` 本身是非法的?
- java - java.util.Timer 中 timer.schedule() 队列的池大小是多少
- javascript - Javascript编程方式获取两个日期对象之间30分钟间隔的时间
- typescript - 插值字符串类型不能用于索引与键类型相同的记录