php-rrule icon indicating copy to clipboard operation
php-rrule copied to clipboard

Rebuild the RFC5545 string from the RSET arrays

Open obrienj970 opened this issue 8 years ago • 3 comments

Is there any code available to rebuild the RFC5545 string from the arrays produced from the RSet() method?

obrienj970 avatar Sep 16 '17 13:09 obrienj970

At the moment no, because I don't know how to do it. Basically the RSet object is more flexible than what the RFC allows, so in some cases there is no way to build a RFC-compliant string out of it. More info here: https://github.com/rlanvin/php-rrule/issues/26#issuecomment-303773780

I am open to suggestions!

rlanvin avatar Sep 16 '17 14:09 rlanvin

Sorry to hear that.

Fortunately my use of RFC5545 is quite simple. At most only oneI RRULE, EXDATE and RDATE in any rule.

But unfortunately my experience with PHP is very limited compared to other languages so my attempt may be quite crude.

How might I use the code in rrule->rfcString to do the RRULE part given that I have an RSET array?

The EXDATE and RDATE pieces should be relatively straight forward

Jim

obrienj970 avatar Sep 16 '17 15:09 obrienj970

How might I use the code in rrule->rfcString to do the RRULE part given that I have an RSET array?

Well basically you would use $rset->getRRules() to get an array, use foreach to loop and call rfcString() on each ones. However problems will occur once you have multiple RRULE, because this will generate multiple DTSTART segments, which is not allowed by the RFC.

rlanvin avatar Sep 18 '17 14:09 rlanvin