-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parsing UNTIL before DTSTART throws format error #25
Comments
Thanks for the detailed bug report, I'll try to provided an answer as detailed. So let's start by stating the obvious: the issue is that the format of your rule is invalid according to the RFC. It should be:
That being said, the error message returned by the parser is indeed confusing and not that helpful, and denotes a wrong behavior.
Where does your string come from? Do you need the lib to accept it "as is" (i.e. not compliant with the RFC), or is it something that you can fix? |
Thanks for the detailed answer ;) That makes sense for why it isn't working. The string actually comes from a javascript client side library: https://github.com/jkbrzt/rrule in which it works as (un)intended. For now I can fix my server side code to provide the php-rrule library with the correct data and I will look into the client side library to see if it can output the correct string. I'm guessing it makes sense to close this Issue? If I end up needing to handle it differently I can PR for that and open a discussion in there. |
Well actually I'll keep the issue open for now. As I explained I think the error message could be improved and clarified, so I'll work on that and close it once I'm done. Also since the JS lib is for some reason generating this kind of string, I'll have a deeper look and see if it's necessary to support it. It would be nice to have good compatibility between frontend and backend - I'm sure you are not the only one is this case. |
For reference, there is a bug report on the JS lib (from January 2015...) about this issue. It is generating a non-compliant string: jkbrzt/rrule#83 |
php-rrule release: v1.4.0
I'm creating an RRule instance:
$rrule = new RRule('DTSTART=20170202T000000Z;FREQ=DAILY;UNTIL=20170205T000000Z')
I get an exception thrown as follows:
Invalid UNTIL property: The value of the UNTIL rule part MUST be a date if DTSTART is a date.
Stack:
I had a look into the cause and it seems to be because
UNTIL
is being parsed beforeDTSTART
.The variable
$dtstart_type
is initialised todate
on line 648, so if it parsesUNTIL
first then it will always throw this error ifUNTIL
is a string.Actually i'm not entirely sure what the desired behaviour is as there is no handling of
DTSTART
specifically within theRRULE
case there. I think my string will always end up in theRRULE
case?If I can understand the thinking then I can maybe help with fixing for my particular use case. Or if my case is invalid then please let me know! I'm no master of the rrule rfc!
The text was updated successfully, but these errors were encountered: