How to generate an RRULE (any RRULE, no matter how supoptimal) from a series of dates— or, failing that, to use RRULE-defined dates in an easily compatible way with lists of dates.
In other words, how to deal with arbitrary lists of dates that modern computer science has collectively decided are impossible to convert to RRULEs, while simultaneously supporting the approach that everyone says to take, RRULE.
Yet deriving RRULEs from lists of dates is so obviously a job for computers that i find it hard to believe that it's not a thing you have to do in third year of undergraduate computer science.
Yes, i've seen this answer: "it's impossible to know the exact rule that generated a collection of dates"
Now, i hope everyone is sitting down, because this is going to blow your minds, but there exists series of repeating dates that were not generated with an RRULE in the first place.
(Not just being facetious; i was surprised myself that the library system in a significant US city would not be using RRULE internally, but to be very concrete about the real-world need for this capability, it does not and we'll close with an example from it.)
So to be very clear, i'm not looking for the 'best' RRULE for a sequence of datetimes, which would be a judgement call anyway. I'm looking for any valid RRULE automatically produced from a list of repeating dates. For example: A fine start would be checking if it's daily and, failing that, producing the ugliest RRULE known to human or machine, that's just a string of exceptions.
And maybe that's another way to approach this: suggestions or examples from when humans are using an RRULE widget to provide the series of events that aren't following nice repeating rules. Do you fall back to just allowing additional dates?
Anyhow, here's that promised real-world example of an array of dates that will have to be regularly dealt with that do not derive from an RRULE themselves, but could probably messily be reduced to one:
"future_dates": [
{
"event_id": 4998685,
"start": "2019-10-01T10:30:00-04:00"
},
{
"event_id": 4998686,
"start": "2019-10-08T10:30:00-04:00"
},
{
"event_id": 4998687,
"start": "2019-10-15T10:30:00-04:00"
},
{
"event_id": 4998688,
"start": "2019-10-22T10:30:00-04:00"
},
{
"event_id": 4998689,
"start": "2019-10-29T10:30:00-04:00"
},
{
"event_id": 4998690,
"start": "2019-11-05T10:30:00-05:00"
},
{
"event_id": 4998691,
"start": "2019-11-12T10:30:00-05:00"
},
{
"event_id": 4998692,
"start": "2019-11-19T10:30:00-05:00"
},
{
"event_id": 4998693,
"start": "2019-11-26T10:30:00-05:00"
},
{
"event_id": 4998694,
"start": "2019-12-03T10:30:00-05:00"
},
{
"event_id": 4998695,
"start": "2019-12-10T10:30:00-05:00"
},
{
"event_id": 4998696,
"start": "2019-12-17T10:30:00-05:00"
},
{
"event_id": 4998698,
"start": "2019-12-31T10:30:00-05:00"
},
{
"event_id": 4998699,
"start": "2020-01-07T10:30:00-05:00"
},
{
"event_id": 4998700,
"start": "2020-01-14T10:30:00-05:00"
},
{
"event_id": 4998701,
"start": "2020-01-21T10:30:00-05:00"
},
{
"event_id": 4998702,
"start": "2020-01-28T10:30:00-05:00"
},
{
"event_id": 4998703,
"start": "2020-02-04T10:30:00-05:00"
},
{
"event_id": 4998704,
"start": "2020-02-11T10:30:00-05:00"
},
{
"event_id": 4998705,
"start": "2020-02-18T10:30:00-05:00"
},
{
"event_id": 4998706,
"start": "2020-02-25T10:30:00-05:00"
},
{
"event_id": 4998707,
"start": "2020-03-03T10:30:00-05:00"
},
{
"event_id": 4998708,
"start": "2020-03-10T10:30:00-04:00"
},
{
"event_id": 4998709,
"start": "2020-03-17T10:30:00-04:00"
},
{
"event_id": 4998710,
"start": "2020-03-24T10:30:00-04:00"
},
{
"event_id": 4998711,
"start": "2020-03-31T10:30:00-04:00"
},
{
"event_id": 4998712,
"start": "2020-04-07T10:30:00-04:00"
},
{
"event_id": 4998713,
"start": "2020-04-14T10:30:00-04:00"
},
{
"event_id": 4998714,
"start": "2020-04-21T10:30:00-04:00"
},
{
"event_id": 4998715,
"start": "2020-04-28T10:30:00-04:00"
},
{
"event_id": 4998716,
"start": "2020-05-05T10:30:00-04:00"
},
{
"event_id": 4998717,
"start": "2020-05-12T10:30:00-04:00"
},
{
"event_id": 4998718,
"start": "2020-05-19T10:30:00-04:00"
},
{
"event_id": 4998719,
"start": "2020-05-26T10:30:00-04:00"
},
{
"event_id": 4998720,
"start": "2020-06-02T10:30:00-04:00"
},
{
"event_id": 4998721,
"start": "2020-06-09T10:30:00-04:00"
},
{
"event_id": 4998722,
"start": "2020-06-16T10:30:00-04:00"
},
{
"event_id": 4998723,
"start": "2020-06-23T10:30:00-04:00"
},
{
"event_id": 4998724,
"start": "2020-06-30T10:30:00-04:00"
},
{
"event_id": 4998725,
"start": "2020-07-07T10:30:00-04:00"
},
{
"event_id": 4998726,
"start": "2020-07-14T10:30:00-04:00"
},
{
"event_id": 4998727,
"start": "2020-07-21T10:30:00-04:00"
},
{
"event_id": 4998728,
"start": "2020-07-28T10:30:00-04:00"
},
{
"event_id": 4998729,
"start": "2020-08-04T10:30:00-04:00"
},
{
"event_id": 4998730,
"start": "2020-08-11T10:30:00-04:00"
},
{
"event_id": 4998731,
"start": "2020-08-18T10:30:00-04:00"
},
{
"event_id": 4998732,
"start": "2020-08-25T10:30:00-04:00"
},
{
"event_id": 4998733,
"start": "2020-09-01T10:30:00-04:00"
},
{
"event_id": 4998734,
"start": "2020-09-08T10:30:00-04:00"
},
{
"event_id": 4998735,
"start": "2020-09-15T10:30:00-04:00"
},
{
"event_id": 4998736,
"start": "2020-09-22T10:30:00-04:00"
},
{
"event_id": 4998737,
"start": "2020-09-29T10:30:00-04:00"
},
{
"event_id": 4998738,
"start": "2020-10-06T10:30:00-04:00"
},
{
"event_id": 4998739,
"start": "2020-10-13T10:30:00-04:00"
},
{
"event_id": 4998740,
"start": "2020-10-20T10:30:00-04:00"
},
{
"event_id": 4998741,
"start": "2020-10-27T10:30:00-04:00"
},
{
"event_id": 4998742,
"start": "2020-11-03T10:30:00-05:00"
},
{
"event_id": 4998743,
"start": "2020-11-10T10:30:00-05:00"
},
{
"event_id": 4998744,
"start": "2020-11-17T10:30:00-05:00"
},
{
"event_id": 4998745,
"start": "2020-11-24T10:30:00-05:00"
},
{
"event_id": 4998746,
"start": "2020-12-01T10:30:00-05:00"
},
{
"event_id": 4998747,
"start": "2020-12-08T10:30:00-05:00"
},
{
"event_id": 4998748,
"start": "2020-12-15T10:30:00-05:00"
},
{
"event_id": 4998749,
"start": "2020-12-22T10:30:00-05:00"
},
{
"event_id": 4998750,
"start": "2020-12-29T10:30:00-05:00"
},
{
"event_id": 4998751,
"start": "2021-01-05T10:30:00-05:00"
},
{
"event_id": 4998752,
"start": "2021-01-12T10:30:00-05:00"
}
]