You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you try to parse a rrule with frequency set to WEEKLY and no BYDAY set, it'll give you an error:
PHP Error: Call to a member function format() on null in .../vendor/simshaun/recurr/src/Recurr/Transformer/TextTransformer.php on line 282
Sample code to reproduce the error: echo (new \Recurr\Transformer\TextTransformer)->transform(new Recurr\Rule('FREQ=WEEKLY'));
This is on version 4.0.2
The text was updated successfully, but these errors were encountered:
markpruett571
changed the title
Unable to transform to text rrule with WEEKLY frequency and no BYDAY
Unable to transform RRule to text when it has a WEEKLY frequency and no BYDAY
Jun 5, 2020
$rrule = new \Recurr\Rule('FREQ=WEEKLY');
$transformer = new \Recurr\Transformer\TextTransformer();
echo$transformer->transform($rrule);
The above example will output: Fatal error: Uncaught Error: Call to a member function format() on null in vendor\simshaun\recurr\src\Recurr\Transformer\TextTransformer.php on line 282
This property is REQUIRED in all types of recurring calendar components that specify the "RRULE" property.
So you must explicitelly define a start date in the constructor.
$rrule = new \Recurr\Rule('FREQ=WEEKLY', new \DateTime());
$transformer = new \Recurr\Transformer\TextTransformer();
echo$transformer->transform($rrule);
The above example will output: weekly on Thursday
Maybe the library should warn the user that the instance lacks of a start date while a rrule is set, avoiding the transformer to throw an exception.
Hi there!
If you try to parse a rrule with frequency set to WEEKLY and no BYDAY set, it'll give you an error:
Sample code to reproduce the error:
echo (new \Recurr\Transformer\TextTransformer)->transform(new Recurr\Rule('FREQ=WEEKLY'));
This is on version 4.0.2
The text was updated successfully, but these errors were encountered: