Rrule from Datetime collection

南楼画角 提交于 2020-02-25 15:04:01

问题


I'm making a recurrent activity calendar system and i'm facing an issue. My activity has a collection of Period items, which contain a StartedAt Datetime and an EndedAt Datetime.

A lot of libs allow me to convert my RRule from a string to Period-like items, but it seems that the reverse (Having multiple "DateTime-couples" converted to a RRule string) isn't common at all.

Any option about this ?


回答1:


A lot of libs allow me to convert my RRule from a string to Period-like items, but it seems that the reverse (Having multiple "DateTime-couples" converted to a RRule string) isn't common at all.

That's because it's not possible. A given RRule generates one and only one set of occurrences, but the opposite is not true - a given set of occurrences can be generated by a multitude of RRules.

In other words, it's impossible to know the exact rule that generated a collection of dates.



来源:https://stackoverflow.com/questions/50628276/rrule-from-datetime-collection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!