Comments (4)
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. DTSTART
is not actually part of the RRULE
string for various reasons (mainly because the RFC is about the iCalendar format, and DTSTART
and RRULE
are 2 separates things).
It should be:
$rrule = new RRule("DTSTART:20170202T000000Z\nRRULE:FREQ=DAILY;UNTIL=20170205T000000Z");
That being said, the error message returned by the parser is indeed confusing and not that helpful, and denotes a wrong behavior.
-
If
DTSTART
is missing (which is the case here) the parser assumes it is simply a date, and then apply the RFC rules to checkUNTIL
. Since yourUNTIL
is a datetime, it complains. At first glance, I think whenDTSTART
is missing, it should accept any format ofUNTIL
. -
The parser relies on the constructor to performs more compliance checks (and initialize DTSTART if it's missing). However in this case, the constructor will indeed accept
DTSTART
as a valid argument (because that's how it works when you pass an array). So I think the parser should probably throw on exception for extraneousDTSTART
. The lib could also be adapted to accept this kind of string, but since they are not RFC compliant (as far as I know) I'm not sure it's a great idea.
If I can understand the thinking then I can maybe help with fixing for my particular use case.
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?
from php-rrule.
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.
from php-rrule.
I'm guessing it makes sense to close this Issue?
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.
from php-rrule.
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
from php-rrule.
Related Issues (20)
- Humanreadable gets monthly wrong HOT 4
- addExRule not working for me HOT 4
- Drop support for PHP < 7.3 HOT 2
- Daylight Savings Time issue with PHP 8.1 HOT 13
- How to create Rrule for every day from X to Y? HOT 4
- How to use exdate with byhour? HOT 3
- Question: Performance optimization when calculating occurrences using multiple rules HOT 3
- exRule and addRule conflict HOT 3
- More forgiving DTSTART behavior when using only date for UNTIL HOT 2
- Nested exrules HOT 2
- occursAt sometimes failing HOT 2
- Problem with getOccurrencesAfter HOT 9
- Removing all dates that are inside a DatePeriod from Rset HOT 1
- bi-weekly occurance wrong HOT 3
- dtstart vs. Repeat Dates / Current Time Not Considered in Calculation HOT 5
- humanreadable not so much HOT 2
- Looking for a way to add DTEND HOT 1
- Exrul not working
- Add alias methods for better reading of code HOT 1
- Legacy Code - Can I 'require_once' instead of composer ? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-rrule.