This is a migrated thread and some comments may be shown as answers.

How to get EndDate from KendoRecurrenceEditor Rule

1 Answer 183 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Neeraj
Top achievements
Rank 1
Veteran
Neeraj asked on 27 Nov 2019, 11:15 AM

I want to extract EndDate from Recurrence Rule Editor. I am able to get the EndDate when the user selects datepicker from radioButton but I am not able to find the EndDate when the user selects occurrence(s) or never radiobutton .

 

var editor = $("#RecurrenceRule").data('kendoRecurrenceEditor');
var endDate = editor._until.value();

 

The above gives me EndDate from Recurrence Editor. But gives wrong date when occurrence and never is selected.

Is there any function which can give me the EndDate? or is there any property in the KendoRecurrenceEditor which stores this date? or is there any other way where i can evaluate the StartDate and Rule to get the EndDate ?

Thank you!

1 Answer, 1 is accepted

Sort by
0
Aleksandar
Telerik team
answered on 29 Nov 2019, 09:43 AM

Hello Neeraj,

The desired result can be achieved, but the implementation should happen on the server. The Scheduler is working with the RFC5545 standard and is creating the recurrence rules according to it. You could use an RFC5545 parser and implement a custom logic that will parse the recurrence rule to different events data based on the initial event. Once you have information on all the events you could store the EndDate of the last one.

For example, if a recurring daily event is created, for three occurrences only the RecurrenceRule would look something like this:

[{
    "TaskID": 0,
    "Title": "No title",
    "Start": "2013-06-10T10:30:00.000Z",
    "End": "2013-06-10T11:00:00.000Z",
    "StartTimezone": "",
    "EndTimezone": "",
    "Description": "",
    "RecurrenceID": "",
    "RecurrenceRule": "FREQ=DAILY;COUNT=3",
    "RecurrenceException": "",
    "OwnerID": 1,
    "IsAllDay": false
}]
What you would need to do to get the EndDate of the particular recurring event
  1. Subscribe to the save event to get the data on the newly created or edited event.
  2. Send the event data to the server
  3. If a recurrence rule is present parse it using an RFC5545 parser and get a list of all events. If no rule is present then this is a single-time event. As you noticed if an EndDate of the recurrence is specified it is present in the RecurrenceRule. 
  4. Once you have all events you can get the EndDate of the last event.

I hope this guide helps you implement the desired functionality. Let me know if you have further questions.

Regards,
Aleksandar
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Scheduler
Asked by
Neeraj
Top achievements
Rank 1
Veteran
Answers by
Aleksandar
Telerik team
Share this question
or