rlanvin / php-rrule

Lightweight and fast recurring dates library for PHP (RFC 5545)
Other
601 stars 83 forks source link

Parsing WordPress RRule Supported or Not? #70

Closed vkiranmaniya closed 5 years ago

vkiranmaniya commented 5 years ago

Is the library capable of parsing and generating occurrences from WordPress recurrence rules? I'm designing a cron to determine active events at the moment to deliver it on the mobile app. My idea is to

  1. Decompose(explode) the rule by ;
  2. Determine Key-Value Pair
  3. Create PHP RRule Object from your Library and get Occurrence dates.
rlanvin commented 5 years ago

I am sorry but I do not understand your question. What is a "WordPress recurrence rule"?

vkiranmaniya commented 5 years ago

I am sorry but I do not understand your question. What is a "WordPress recurrence rule"?

Wordpress has event manager built in and it manages recurring events by recurrence rules. so my question is, is it possible to parse WordPress rules? here is the sample json properties commning from wordpress rest api { "post_id": "74768", "start": "1552827600", "end": "1552828500", "timezone_name": "Asia/Bangkok", "allday": "0", "instant_event": "1", "recurrence_rules": "FREQ=WEEKLY;WKST=SU;BYday=SU;", "exception_rules": "EXDATE=20191229T000000Z", "recurrence_dates": null, "exception_dates": "20191229T000000Z", }

rlanvin commented 5 years ago

I see, well it looks like the field recurrence_rules in your JSON is using the correct format, so that shouldn't be any problem.

The start date is apparently a combination of start and timezone_name.

There is also exception_rules, recurrence_dates and exception_dates. For these you will need to create a RSet object to combine them with the rule..

Long story short: yes the library will work, but you will need to do a bit of conversion.

vkiranmaniya commented 5 years ago

I did it. Thanks for your response.