解析 iCal RRULE(来自 RFC 5545)
我正在寻找一种使用 ruby(在轨道上)解析重复事件的解决方案。
我想解析约会的 RRULE 部分,以了解它是否发生在 2 个日期之间。
例如,我有这样的规则:
FREQ=YEARLY;BYMONTHDAY=6;BYMONTH=11;
我想知道今年什么时候发生:
scheduler.parse_ical('DTSTART:20111216T090000Z;RRULE:FREQ=YEARLY;BYMONTHDAY=6;BYMONTH=11;')
scheduler.occurrences(Time.now, Time.now + 2.years)
=> return : 2012-11-06 09:00:00, 2013-11-06 09:00:00
非常感谢任何建议
I'm looking for a solution to parsing recurring event with ruby (on rails).
I'd like to parse RRULE part of an appointment to know if it's occurs between 2 date.
For exemple, I have this rule :
FREQ=YEARLY;BYMONTHDAY=6;BYMONTH=11;
I like to know when it occur this year:
scheduler.parse_ical('DTSTART:20111216T090000Z;RRULE:FREQ=YEARLY;BYMONTHDAY=6;BYMONTH=11;')
scheduler.occurrences(Time.now, Time.now + 2.years)
=> return : 2012-11-06 09:00:00, 2013-11-06 09:00:00
Any suggestions are greatly appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题自己解决了:-)
我会分叉ice_cube库并提交一些补丁来具有此功能:https://github .com/digITpro/ice_cube
Problem solved by myself :-)
I'd fork ice_cube library and commit some patch to have this functionality : https://github.com/digITpro/ice_cube