-
-
Notifications
You must be signed in to change notification settings - Fork 519
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
Request For Comments: Proposed rrule 3.0 API design #298
Comments
I’m for removing it.
I’m for removing this as well. With Excellent proposal, thanks @davidgoli! |
I'm not sure if this is something you'd be interested in adding to this library, but a killer feature I need (which I implemented in rSchedule) is the ability to combine/manipulate multiple RRule objects (recurrence streams). Some examples:
If you implemented operator functions like these, then someone could create their own
For me, implementing this in rrulejs might allow me to remove the recurrence logic from rSchedule--allowing me to turn the rSchedule library into a simple collection of wrapper classes (i.e. I tend to think of these transformations as akin to rxjs pipe transformations. Building off the api you outlined above, an implementation might look like all(
combineOptions(
add(rruleOptionOne, rruleOptionTwo),
subtract(exruleOption),
add(rdateOne, rdateTwo, rdateThree),
subtract(exdateOne),
unique(),
)
)
// might return:
[ '2012-02-01T10:30:00.000Z',
'2012-05-01T10:30:00.000Z',
'2012-07-01T10:30:00.000Z',
'2012-07-02T10:30:00.000Z' ] |
@davidgoli This is a great libray! How is v3 coming along? Did you abandon the idea of a new API? I'm curious to know because I'm building a task scheduler based on rrule and I'd like my api to be as future proof as possible. One thing would be to not support RRuleSet in my api if you're planning to remove it anyway. |
How is v3 coming along? |
For @rofrol and others, I can't immediately find the comment, but I seem to remember that @davidgoli mentioned he no longer uses rrule and is no longer actively working on it. At the moment I believe this library is not actively maintained. |
What are people using instead? |
rSchedule @matheusbaumgart. Though I made it, so I'm definitely biased. |
The original version of this library was a port of Python's
dateutil.rrule
library. The syntax was thus very "Pythonic" and not very JavaScript-y, thus leading to a lot of inconsistencies. For example:rrulestr
may return an RRule or an RRuleSet, which implement different interfacesRRule
orRRuleSet
instance is partially mutable (so calling some instance methods will change behavior of others), but not predictably so (so modifying instance state, egrrule.options
, may or may not have an effect on the output)Proposal for rrule 3.0
Better RFC compliance
The proposed approach centers around the
options
object. Its syntax structure should be consistent with the structure of the RFC spec:Strings and options objects are interchangeable
Immutability
RRule should use a function-based, immutable approach, where
options
objects are just plain-old JS (POJS) objects (or their string equivalents), and a suite of functions is provided to generate JS dates, which are completely deterministic (the sameoptions
object or string always returns the same set of dates):Question: How important is the
Cache
functionality? Could it be removed from this library and replaced in client code by memoization?Remove RRuleSet
rrulestr
will now simply return a parsedoptions
object. Theoptions
object also supports the extensions formerly available only toRRuleSet
, meaning that a completeRRuleSet
can be specified declaratively in a single statement:Question:
EXRULE
has been deprecated in RFC 5545. Is it important to continue supporting it?Future enhancement:
RRULE
andEXRULE
could support arrays ofoptions
in addition tooptions
.Move NLP to its own npm package
rrule-nlp provides useful, if neglected, functionality. Its methods are concerned not with describing sets of dates (the output), but describing the rrule options itself (the input). It should be treated as its own package and removed from the main rrule package in the interest of size.
I expect to have a working implementation of this proposal by February 1, 2019. I'm opening a comment period on this proposal until that time. Thank you for your interest in this library!
The text was updated successfully, but these errors were encountered: