search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

RecurrenceExpander.Expand method .. Is the table an absolute requirement?

Asked by mrplatypus
6 years ago.

Dan and Team,

In the following article:
http://forums.daypilot.org/Topic.aspx/3053/example-of-storing-recurring-events-as-separate-records-ple

You mention that the,

RecurrenceExpander.Expand(expandedRuleTable, "recurrence", "start", "end", "id", "master", start, end);

, call requires an input parameter of a .net table ..

Is this an absolute requirement?

Please advise.

Thanks

Dave

Answer posted by Dan Letecky [DayPilot]
6 years ago.

Dave, for the full functionality the DataTable is required:

  • it reads the recurrence fields automatically
  • it parses the master events and exceptions
  • it copies all the fields from the master to the occurrences and exceptions

This is not possible with custom objects (especially because of the copying).

However, for simple rule expanding you can now use RecurrenceRule.Occurrences() method (since build 8.1.3491:

RecurrenceRule r = RecurrenceRule.Decode("......encoded rule string.....");
List<DateTime> occurrences = r.Occurrences(DateTime.Today, DateTime.Today.AddMonths(1));

This example will return a list of dates (expanded occurrences). Just note a few things:

  • you need to supply a DateTime range to Occurrences(from, to)
  • it only returns the Date part (the smallest recurrence unit is one day)

You can download the latest build in the sandbox:

http://www.daypilot.org/sandbox/

Comment posted by mrplatypus
6 years ago.

Dan,

Thats a good bit of functionality, however, are there any plans to expand that out to show the date and times too?

Thanks

Dave

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.