)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to parse the RecurrenceRule at server side?

Platform: ASP.NET MVC - EJ 2 |
Control: Schedule |
Published Date: December 13, 2018 |
Last Revised Date: December 13, 2018

This knowledge base article explains the way to parse the recurrence rule at server side by making use of a new generic utility class RecurrenceHelper.

 

By referring to the RecurrenceHelper class in your sample project, you can make use of the GetRecurrenceDateTimeCollection method which automatically generates the date instances as a result. Below 4 type parameters can be passed to GetRecurrenceDateTimeCollection method.

 

Type 1: Recurrence rule and start date value (Mandatory parameters).

In this type, we need to pass two mandatory arguments such as recurrence rule and recurrence start date. 

 

Type 2: Maximum number of occurrences to retrieve. 

In this type, we can pass the maximum occurrences count (ex: 60) to be retrieved when “Ends Never” option is present in the recurrence. By default, the Ends never maximum count is processed as 43.

 

Type 3: RecurrenceException.

In this type, we can pass the RecurrenceException date (ex: "20180610T040000Z") for excluding the dates along with mandatory arguments.

 

Type 4: Maximum number of occurrences to retrieve and RecurrenceException.  

 

In this type, we can pass the RecurrenceException for excluding the dates (ex: "20180610T040000Z") and the maximum occurrence count (ex: 60) for the “Ends Never” option, with the mandatory arguments.  

 

 

The following steps explains the way to parse the Recurrence Editor control’s recurrence rule using RecurrenceHelper utility class.

 

Step 1: Create an MVC application with Recurrence Editor by referring the following user guide link.

https://ej2.syncfusion.com/aspnetmvc/documentation/schedule/recurrence-editor/?no-cache=1#recurrence-editor

Also, define the Change client-side event as shown in the following code example.

 

Step 2: Within the Recurrence Editor Change event, the selected recurrence rule is sent to the getDates controller function as shown in the following code example.

 

Step 3: In getDates controller function recurrence rule is parsed using GetRecurrenceDateTimeCollection method and date collections are returned as shown in the following code example.

 

 

Step 4: Run the sample, initially Recurrence Editor is displayed as shown in the following image.

 

      Figure 1: Default Recurrence Editor.

 

When the rule is changed to Daily, corresponding date collections will be displayed as shown in the following image.

 

     Figure 2: Recurrence Editor with Daily rule and its corresponding date collections.

 

Please refer the example and recurrence helper class file from the following GitHub links.

Example - Recurrence Parser

Class file - Recurrence Helper

 

2X faster development

The ultimate ASP.NET MVC UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon