Problem


You have a recurring event in your event list:



When you connect above list to Events ShortPoint element, you would not see the recurring event occurrences:



Reason


Recurrences have been handled differently in SharePoint and requesting all list items of calendar does not return all occurrences of events if its recurring event. 


Solution


Step 1: Add Events ShortPoint element


In the page where you would want to add Events ShortPoint, add ShortPoint and select Events



Step 2: Connect using REST API Connection


Go to Connect Tab and select REST API Connection Type



In REST API URL, provide below URL:


<https://your-site>/_api/web/lists/getbytitle('<Events List Title>')/items?$select=*,Duration,RecurrenceData


<https://your-site>: Replace with your site URL (for example https://contoso.sharepoint.com)

<Events List Title>: Replace with title of your events list (for example Events)


Example URL: https://shortpoint.sharepoint.com/_api/web/lists/getbytitle('Calendar')/items?$select=*,Duration,RecurrenceData


Step 3: Use custom mapping to expand the recurrences of recurring event



Enable the Advanced Mapping and in Map Results and use the code given in below options as per your need:


OPTION 1: Show all events


var spEventsParser = { parseEvents: function (e, t, a) { for (var n = [], r = 0; r < e.length; r++)n = n.concat(this.parseEvent(e[r], t, a)); return n }, formatString: function (e) { var t = e.split("'"); return e = t.join(""), t = e.split('"'), e = t.join(""), t = e.split("="), e = t.join(" "), e.trim(), e.split(" ") }, parseDate: function (e, t) { if ("string" == typeof e) { if (!t) return new Date(e); if (e.lastIndexOf("Z") == e.length - 1) { var a = e.substring(0, e.length - 1); return new Date(a) } } return e }, parseEvent: function (e, t, a) { if (e.fRecurrence) { t = t || this.parseDate(e.EventDate, e.fAllDayEvent), a = a || this.parseDate(e.EndDate, e.fAllDayEvent); var n = [], r = ["su", "mo", "tu", "we", "th", "fr", "sa"], D = ["first", "second", "third", "fourth"], s = 0, i = 0; if (-1 != e.RecurrenceData.indexOf("<repeatInstances>") && (s = e.RecurrenceData.substring(e.RecurrenceData.indexOf("<repeatInstances>") + 17), s = parseInt(s.substring(0, s.indexOf("<")))), -1 != e.RecurrenceData.indexOf("<daily ")) { var f = e.RecurrenceData.substring(e.RecurrenceData.indexOf("<daily ")); f = f.substring(7, f.indexOf("/>") - 1); var o = this.formatString(f); if (-1 != o.indexOf("dayFrequency")) for (var g = parseInt(o[o.indexOf("dayFrequency") + 1]), c = !0, d = this.parseDate(e.EventDate, e.fAllDayEvent); c;) { if (i++ , new Date(d).getTime() >= t.getTime()) { var u = new Date(d); u.setSeconds(u.getSeconds() + e.Duration); var l = this.cloneObj(e); l.EventDate = new Date(d), l.EndDate = u, l.fRecurrence = !1, l.Id = e.Id, l.ID = l.Id, n.push(l) } d.setDate(d.getDate() + g), (new Date(d) > a || s > 0 && i >= s) && (c = !1) } else -1 != o.indexOf("weekday") && (e.RecurrenceData = e.RecurrenceData + "<weekly mo='TRUE' tu='TRUE' we='TRUE' th='TRUE' fr='TRUE' weekFrequency='1' />") } if (-1 != e.RecurrenceData.indexOf("<weekly ")) { var f = e.RecurrenceData.substring(e.RecurrenceData.indexOf("<weekly ")); f = f.substring(8, f.indexOf("/>") - 1); for (var o = this.formatString(f), g = parseInt(o[o.indexOf("weekFrequency") + 1]), c = !0, d = this.parseDate(e.EventDate, e.fAllDayEvent), v = d.getDay(); c;) { for (var h = v; 7 > h; h++)if (-1 != o.indexOf(r[h]) && (s > i || 0 == s) && (i++ , new Date(d).getTime() >= t.getTime())) { var y = new Date(d); y.setDate(y.getDate() + (h - v)); var u = new Date(y); u.setSeconds(u.getSeconds() + e.Duration); var l = this.cloneObj(e); l.EventDate = new Date(y), l.EndDate = u, l.fRecurrence = !1, l.Id = e.Id, l.ID = l.Id, n.push(l) } d.setDate(d.getDate() + (7 * g - v)), v = 0, (new Date(d) > a || s > 0 && i >= s) && (c = !1) } } if (-1 != e.RecurrenceData.indexOf("<monthly ")) { var f = e.RecurrenceData.substring(e.RecurrenceData.indexOf("<monthly ")); f = f.substring(9, f.indexOf("/>") - 1); for (var o = this.formatString(f), g = parseInt(o[o.indexOf("monthFrequency") + 1]), c = !0, d = this.parseDate(e.EventDate, e.fAllDayEvent), w = parseInt(o[o.indexOf("day") + 1]); c;) { if (i++ , new Date(d).getTime() >= t.getTime()) { var y = new Date(d); if (y.setDate(w), y.getMonth() == d.getMonth()) { var u = new Date(y); u.setSeconds(u.getSeconds() + e.Duration); var l = this.cloneObj(e); l.EventDate = new Date(y), l.EndDate = u, l.fRecurrence = !1, l.Id = e.Id, l.ID = l.Id, n.push(l) } } d.setMonth(d.getMonth() + g), (new Date(d) > a || s > 0 && i >= s) && (c = !1) } } if (-1 != e.RecurrenceData.indexOf("<monthlyByDay ")) { var f = e.RecurrenceData.substring(e.RecurrenceData.indexOf("<monthlyByDay ")); f = f.substring(14, f.indexOf("/>") - 1); for (var o = this.formatString(f), g = parseInt(o[o.indexOf("monthFrequency") + 1]), c = !0, d = this.parseDate(e.EventDate, e.fAllDayEvent), O = o[o.indexOf("weekdayOfMonth") + 1], x = new Date; c;) { if (i++ , new Date(d).getTime() >= t.getTime()) { var y = new Date(d); if (y.setDate(1), -1 != o.indexOf("weekday")) if (0 == y.getDay() ? y.setDate(y.getDate() + 1) : 6 == y.getDay() && y.setDate(y.getDate() + 2), "last" == O) { for (; y.getMonth() == d.getMonth();)x = new Date(y), y.setDate(5 == y.getDay() ? y.getDate() + 3 : y.getDate() + 1); y = new Date(x) } else for (var h = 0; h < D.indexOf(O); h++)y.setDate(5 == y.getDay() ? y.getDate() + 3 : y.getDate() + 1); else if (-1 != o.indexOf("weekend_day")) if (0 != y.getDay() && 6 != y.getDay() && y.setDate(y.getDate() + (6 - y.getDay())), "last" == O) { for (; y.getMonth() == d.getMonth();)x = new Date(y), y.setDate(0 == y.getDay() ? y.getDate() + 6 : y.getDate() + 1); y = new Date(x) } else for (var h = 0; h < D.indexOf(O); h++)y.setDate(0 == y.getDay() ? y.getDate() + 6 : y.getDate() + 1); else if (-1 != o.indexOf("day")) if ("last" == O) { var y = y.setMonth(y.getMonth() + 1); y.setDate(0) } else y.setDate(y.getDate() + D.indexOf(O)); else { for (var h = 0; h < r.length; h++)-1 != o.indexOf(r[h]) && y.setDate(y.getDay() > h ? y.getDate() + (7 - (y.getDay() - h)) : y.getDate() + (h - y.getDay())); if ("last" == O) { for (; y.getMonth() == d.getMonth();)x = new Date(y), y.setDate(y.getDate() + 7); y = new Date(x) } else for (var h = 0; h < D.indexOf(O); h++)y.setDate(y.getDate() + 7) } if (y.getMonth() == d.getMonth()) { var u = new Date(y); u.setSeconds(u.getSeconds() + e.Duration); var l = this.cloneObj(e); l.EventDate = new Date(y), l.EndDate = u, l.fRecurrence = !1, l.Id = e.Id, l.ID = l.Id, n.push(l) } } d.setMonth(d.getMonth() + g), (new Date(d) > a || s > 0 && i >= s) && (c = !1) } } if (-1 != e.RecurrenceData.indexOf("<yearly ")) { var f = e.RecurrenceData.substring(e.RecurrenceData.indexOf("<yearly ")); f = f.substring(8, f.indexOf("/>") - 1); for (var o = this.formatString(f), g = parseInt(o[o.indexOf("yearFrequency") + 1]), c = !0, d = this.parseDate(e.EventDate, e.fAllDayEvent), p = parseInt(o[o.indexOf("month") + 1]) - 1, w = parseInt(o[o.indexOf("day") + 1]); c;) { var y = new Date(d); if (y.setMonth(p), y.setDate(w), new Date(d).getTime() <= y.getTime() && (i++ , new Date(d).getTime() >= t.getTime())) { var u = new Date(y); u.setSeconds(u.getSeconds() + e.Duration); var l = this.cloneObj(e); l.EventDate = new Date(y), l.EndDate = u, l.fRecurrence = !1, l.Id = e.Id, l.ID = l.Id, n.push(l) } d.setFullYear(d.getFullYear() + g), (new Date(d) > a || s > 0 && i >= s) && (c = !1) } } if (-1 != e.RecurrenceData.indexOf("<yearlyByDay ")) { var f = e.RecurrenceData.substring(e.RecurrenceData.indexOf("<yearlyByDay ")); f = f.substring(13, f.indexOf("/>") - 1); for (var o = this.formatString(f), g = parseInt(o[o.indexOf("yearFrequency") + 1]), c = !0, d = this.parseDate(e.EventDate, e.fAllDayEvent), p = parseInt(o[o.indexOf("month") + 1]) - 1, O = o[o.indexOf("weekdayOfMonth") + 1], w = 0, h = 0; h < r.length; h++)-1 != o.indexOf(r[h]) && "true" == o[o.indexOf(r[h]) + 1].toLowerCase() && (w = h); for (; c;) { var y = new Date(d); if (y.setMonth(p), new Date(d).getTime() <= y.getTime() && (i++ , new Date(d).getTime() >= t.getTime())) { y.setDate(1); var E = y.getDay(); if (y.setDate(E > w ? y.getDate() + (7 - E + w) : y.getDate() + (w - E)), "last" == O) for (var x = new Date(y); x.getMonth() == p;)y = new Date(x), x.setDate(x.getDate() + 7); else y.setDate(y.getDate() + 7 * D.indexOf(O)); if (y.getMonth() == p) { var u = new Date(y); u.setSeconds(u.getSeconds() + e.Duration); var l = this.cloneObj(e); l.EventDate = new Date(y), l.EndDate = u, l.fRecurrence = !1, l.Id = e.Id, l.ID = l.Id, n.push(l) } } d.setFullYear(d.getFullYear() + g), d.setMonth(p), d.setDate(1), (new Date(d) > a || s > 0 && i >= s) && (c = !1) } } return n } return e.EventDate = new Date(this.parseDate(e.EventDate, e.fAllDayEvent)), e.EndDate = new Date(this.parseDate(e.EndDate, e.fAllDayEvent)), [e] }, cloneObj: function (e) { var t; if (null == e || "object" != typeof e) return e; if (e instanceof Date) return t = new Date, t.setTime(e.getTime()), t; if (e instanceof Array) { t = []; for (var a = 0, n = e.length; n > a; a++)t[a] = this.cloneObj(e[a]); return t } if (e instanceof Object) { t = {}; for (var r in e) e.hasOwnProperty(r) && (t[r] = this.cloneObj(e[r])); return t } throw new Error("Unable to copy obj! Its type isn't supported.") } };
var eventResults = data.d.results;
var parsedArray = spEventsParser.parseEvents(eventResults);
var _ = shortpoint.base.libs._;
var sortedData = _.sortBy(parsedArray, function (a) {
    return a.EventDate ;
});

var $ = shortpoint.$;
currentSite = window.location.protocol + "//" + window.location.host + _spPageContextInfo.webServerRelativeUrl;
TimeZone = {};
 $.ajax({
            url: currentSite + "/_api/Web/RegionalSettings/TimeZone",
            method: "GET",
      async: false,
            headers: { "Accept": "application/json; odata=verbose" },
        }).done(function (response) {
      TimeZone = response.d;
            sortedData.forEach(function(item, index){
        //var d = this.EventDate;
        var localTime = item.EventDate.getTime();
        var localEndTime = item.EndDate.getTime();
        var regionTimeoffset = (TimeZone.Information.Bias + TimeZone.Information.DaylightBias) * 60000;
        var localTimeoffset =  item.EventDate.getTimezoneOffset() * 60000;
        item.EventDate = new Date();
        item.EventDate.setTime(localTime + ((localTimeoffset - regionTimeoffset )));
        item.EndDate = new Date();
        item.EndDate.setTime(localEndTime + ((localTimeoffset - regionTimeoffset )));
        if(item.RecurrenceData != null){
          var instnaceDate = new Date();
          instnaceDate.setTime(localTime );
          item.DisplayId = item.Id + ".0."+ instnaceDate.toISOString().replace(".000Z","Z") ;
        }else{
          item.DisplayId = item.Id;
        }
        });
        return sortedData;
        });   
return sortedData;



OPTION 2: Show events of the next few days


var spEventsParser = { parseEvents: function (e, t, a) { for (var n = [], r = 0; r < e.length; r++)n = n.concat(this.parseEvent(e[r], t, a)); return n }, formatString: function (e) { var t = e.split("'"); return e = t.join(""), t = e.split('"'), e = t.join(""), t = e.split("="), e = t.join(" "), e.trim(), e.split(" ") }, parseDate: function (e, t) { if ("string" == typeof e) { if (!t) return new Date(e); if (e.lastIndexOf("Z") == e.length - 1) { var a = e.substring(0, e.length - 1); return new Date(a) } } return e }, parseEvent: function (e, t, a) { if (e.fRecurrence) { t = t || this.parseDate(e.EventDate, e.fAllDayEvent), a = a || this.parseDate(e.EndDate, e.fAllDayEvent); var n = [], r = ["su", "mo", "tu", "we", "th", "fr", "sa"], D = ["first", "second", "third", "fourth"], s = 0, i = 0; if (-1 != e.RecurrenceData.indexOf("<repeatInstances>") && (s = e.RecurrenceData.substring(e.RecurrenceData.indexOf("<repeatInstances>") + 17), s = parseInt(s.substring(0, s.indexOf("<")))), -1 != e.RecurrenceData.indexOf("<daily ")) { var f = e.RecurrenceData.substring(e.RecurrenceData.indexOf("<daily ")); f = f.substring(7, f.indexOf("/>") - 1); var o = this.formatString(f); if (-1 != o.indexOf("dayFrequency")) for (var g = parseInt(o[o.indexOf("dayFrequency") + 1]), c = !0, d = this.parseDate(e.EventDate, e.fAllDayEvent); c;) { if (i++ , new Date(d).getTime() >= t.getTime()) { var u = new Date(d); u.setSeconds(u.getSeconds() + e.Duration); var l = this.cloneObj(e); l.EventDate = new Date(d), l.EndDate = u, l.fRecurrence = !1, l.Id = e.Id, l.ID = l.Id, n.push(l) } d.setDate(d.getDate() + g), (new Date(d) > a || s > 0 && i >= s) && (c = !1) } else -1 != o.indexOf("weekday") && (e.RecurrenceData = e.RecurrenceData + "<weekly mo='TRUE' tu='TRUE' we='TRUE' th='TRUE' fr='TRUE' weekFrequency='1' />") } if (-1 != e.RecurrenceData.indexOf("<weekly ")) { var f = e.RecurrenceData.substring(e.RecurrenceData.indexOf("<weekly ")); f = f.substring(8, f.indexOf("/>") - 1); for (var o = this.formatString(f), g = parseInt(o[o.indexOf("weekFrequency") + 1]), c = !0, d = this.parseDate(e.EventDate, e.fAllDayEvent), v = d.getDay(); c;) { for (var h = v; 7 > h; h++)if (-1 != o.indexOf(r[h]) && (s > i || 0 == s) && (i++ , new Date(d).getTime() >= t.getTime())) { var y = new Date(d); y.setDate(y.getDate() + (h - v)); var u = new Date(y); u.setSeconds(u.getSeconds() + e.Duration); var l = this.cloneObj(e); l.EventDate = new Date(y), l.EndDate = u, l.fRecurrence = !1, l.Id = e.Id, l.ID = l.Id, n.push(l) } d.setDate(d.getDate() + (7 * g - v)), v = 0, (new Date(d) > a || s > 0 && i >= s) && (c = !1) } } if (-1 != e.RecurrenceData.indexOf("<monthly ")) { var f = e.RecurrenceData.substring(e.RecurrenceData.indexOf("<monthly ")); f = f.substring(9, f.indexOf("/>") - 1); for (var o = this.formatString(f), g = parseInt(o[o.indexOf("monthFrequency") + 1]), c = !0, d = this.parseDate(e.EventDate, e.fAllDayEvent), w = parseInt(o[o.indexOf("day") + 1]); c;) { if (i++ , new Date(d).getTime() >= t.getTime()) { var y = new Date(d); if (y.setDate(w), y.getMonth() == d.getMonth()) { var u = new Date(y); u.setSeconds(u.getSeconds() + e.Duration); var l = this.cloneObj(e); l.EventDate = new Date(y), l.EndDate = u, l.fRecurrence = !1, l.Id = e.Id, l.ID = l.Id, n.push(l) } } d.setMonth(d.getMonth() + g), (new Date(d) > a || s > 0 && i >= s) && (c = !1) } } if (-1 != e.RecurrenceData.indexOf("<monthlyByDay ")) { var f = e.RecurrenceData.substring(e.RecurrenceData.indexOf("<monthlyByDay ")); f = f.substring(14, f.indexOf("/>") - 1); for (var o = this.formatString(f), g = parseInt(o[o.indexOf("monthFrequency") + 1]), c = !0, d = this.parseDate(e.EventDate, e.fAllDayEvent), O = o[o.indexOf("weekdayOfMonth") + 1], x = new Date; c;) { if (i++ , new Date(d).getTime() >= t.getTime()) { var y = new Date(d); if (y.setDate(1), -1 != o.indexOf("weekday")) if (0 == y.getDay() ? y.setDate(y.getDate() + 1) : 6 == y.getDay() && y.setDate(y.getDate() + 2), "last" == O) { for (; y.getMonth() == d.getMonth();)x = new Date(y), y.setDate(5 == y.getDay() ? y.getDate() + 3 : y.getDate() + 1); y = new Date(x) } else for (var h = 0; h < D.indexOf(O); h++)y.setDate(5 == y.getDay() ? y.getDate() + 3 : y.getDate() + 1); else if (-1 != o.indexOf("weekend_day")) if (0 != y.getDay() && 6 != y.getDay() && y.setDate(y.getDate() + (6 - y.getDay())), "last" == O) { for (; y.getMonth() == d.getMonth();)x = new Date(y), y.setDate(0 == y.getDay() ? y.getDate() + 6 : y.getDate() + 1); y = new Date(x) } else for (var h = 0; h < D.indexOf(O); h++)y.setDate(0 == y.getDay() ? y.getDate() + 6 : y.getDate() + 1); else if (-1 != o.indexOf("day")) if ("last" == O) { var y = y.setMonth(y.getMonth() + 1); y.setDate(0) } else y.setDate(y.getDate() + D.indexOf(O)); else { for (var h = 0; h < r.length; h++)-1 != o.indexOf(r[h]) && y.setDate(y.getDay() > h ? y.getDate() + (7 - (y.getDay() - h)) : y.getDate() + (h - y.getDay())); if ("last" == O) { for (; y.getMonth() == d.getMonth();)x = new Date(y), y.setDate(y.getDate() + 7); y = new Date(x) } else for (var h = 0; h < D.indexOf(O); h++)y.setDate(y.getDate() + 7) } if (y.getMonth() == d.getMonth()) { var u = new Date(y); u.setSeconds(u.getSeconds() + e.Duration); var l = this.cloneObj(e); l.EventDate = new Date(y), l.EndDate = u, l.fRecurrence = !1, l.Id = e.Id, l.ID = l.Id, n.push(l) } } d.setMonth(d.getMonth() + g), (new Date(d) > a || s > 0 && i >= s) && (c = !1) } } if (-1 != e.RecurrenceData.indexOf("<yearly ")) { var f = e.RecurrenceData.substring(e.RecurrenceData.indexOf("<yearly ")); f = f.substring(8, f.indexOf("/>") - 1); for (var o = this.formatString(f), g = parseInt(o[o.indexOf("yearFrequency") + 1]), c = !0, d = this.parseDate(e.EventDate, e.fAllDayEvent), p = parseInt(o[o.indexOf("month") + 1]) - 1, w = parseInt(o[o.indexOf("day") + 1]); c;) { var y = new Date(d); if (y.setMonth(p), y.setDate(w), new Date(d).getTime() <= y.getTime() && (i++ , new Date(d).getTime() >= t.getTime())) { var u = new Date(y); u.setSeconds(u.getSeconds() + e.Duration); var l = this.cloneObj(e); l.EventDate = new Date(y), l.EndDate = u, l.fRecurrence = !1, l.Id = e.Id, l.ID = l.Id, n.push(l) } d.setFullYear(d.getFullYear() + g), (new Date(d) > a || s > 0 && i >= s) && (c = !1) } } if (-1 != e.RecurrenceData.indexOf("<yearlyByDay ")) { var f = e.RecurrenceData.substring(e.RecurrenceData.indexOf("<yearlyByDay ")); f = f.substring(13, f.indexOf("/>") - 1); for (var o = this.formatString(f), g = parseInt(o[o.indexOf("yearFrequency") + 1]), c = !0, d = this.parseDate(e.EventDate, e.fAllDayEvent), p = parseInt(o[o.indexOf("month") + 1]) - 1, O = o[o.indexOf("weekdayOfMonth") + 1], w = 0, h = 0; h < r.length; h++)-1 != o.indexOf(r[h]) && "true" == o[o.indexOf(r[h]) + 1].toLowerCase() && (w = h); for (; c;) { var y = new Date(d); if (y.setMonth(p), new Date(d).getTime() <= y.getTime() && (i++ , new Date(d).getTime() >= t.getTime())) { y.setDate(1); var E = y.getDay(); if (y.setDate(E > w ? y.getDate() + (7 - E + w) : y.getDate() + (w - E)), "last" == O) for (var x = new Date(y); x.getMonth() == p;)y = new Date(x), x.setDate(x.getDate() + 7); else y.setDate(y.getDate() + 7 * D.indexOf(O)); if (y.getMonth() == p) { var u = new Date(y); u.setSeconds(u.getSeconds() + e.Duration); var l = this.cloneObj(e); l.EventDate = new Date(y), l.EndDate = u, l.fRecurrence = !1, l.Id = e.Id, l.ID = l.Id, n.push(l) } } d.setFullYear(d.getFullYear() + g), d.setMonth(p), d.setDate(1), (new Date(d) > a || s > 0 && i >= s) && (c = !1) } } return n } return e.EventDate = new Date(this.parseDate(e.EventDate, e.fAllDayEvent)), e.EndDate = new Date(this.parseDate(e.EndDate, e.fAllDayEvent)), [e] }, cloneObj: function (e) { var t; if (null == e || "object" != typeof e) return e; if (e instanceof Date) return t = new Date, t.setTime(e.getTime()), t; if (e instanceof Array) { t = []; for (var a = 0, n = e.length; n > a; a++)t[a] = this.cloneObj(e[a]); return t } if (e instanceof Object) { t = {}; for (var r in e) e.hasOwnProperty(r) && (t[r] = this.cloneObj(e[r])); return t } throw new Error("Unable to copy obj! Its type isn't supported.") } };
var eventResults = data.d.results;
var parsedArray = spEventsParser.parseEvents(eventResults);
var numberOfDays = <Number Of Days>;
var today = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate());
var endOfPeriod = new Date();
endOfPeriod = new Date(endOfPeriod.setDate(today.getDate() + numberOfDays + 1));
endOfPeriod = new Date(endOfPeriod.getFullYear(), endOfPeriod.getMonth(), endOfPeriod.getDate());
var _ = shortpoint.base.libs._;
var filteredData = _.filter(parsedArray, function (data) {
    return data.EventDate >= today && data.EventDate <= endOfPeriod;
});
var sortedData = _.sortBy(filteredData, function (a) {
    return a.EventDate;
});
var $ = shortpoint.$;
currentSite = window.location.protocol + "//" + window.location.host + _spPageContextInfo.webServerRelativeUrl;
TimeZone = {};
 $.ajax({
            url: currentSite + "/_api/Web/RegionalSettings/TimeZone",
            method: "GET",
      async: false,
            headers: { "Accept": "application/json; odata=verbose" },
        }).done(function (response) {
      TimeZone = response.d;
            sortedData.forEach(function(item, index){
        //var d = this.EventDate;
        var localTime = item.EventDate.getTime();
        var localEndTime = item.EndDate.getTime();
        var regionTimeoffset = (TimeZone.Information.Bias + TimeZone.Information.DaylightBias) * 60000;
        var localTimeoffset =  item.EventDate.getTimezoneOffset() * 60000;
        item.EventDate = new Date();
        item.EventDate.setTime(localTime + ((localTimeoffset - regionTimeoffset )));
        item.EndDate = new Date();
        item.EndDate.setTime(localEndTime + ((localTimeoffset - regionTimeoffset )));
        if(item.RecurrenceData != null){
          var instnaceDate = new Date();
          instnaceDate.setTime(localTime );
          item.DisplayId = item.Id + ".0."+ instnaceDate.toISOString().replace(".000Z","Z") ;
        }else{
          item.DisplayId = item.Id;
        }
        });
        return sortedData;
        });  
return sortedData;



<Number Of Days>: Replace with the number of days you need to show the event for. For example, if you want to show events of next 5 days including today's day, you should keep it like var numberOfDays = 5;


OPTION 3: Show events of current week


var spEventsParser = { parseEvents: function (e, t, a) { for (var n = [], r = 0; r < e.length; r++)n = n.concat(this.parseEvent(e[r], t, a)); return n }, formatString: function (e) { var t = e.split("'"); return e = t.join(""), t = e.split('"'), e = t.join(""), t = e.split("="), e = t.join(" "), e.trim(), e.split(" ") }, parseDate: function (e, t) { if ("string" == typeof e) { if (!t) return new Date(e); if (e.lastIndexOf("Z") == e.length - 1) { var a = e.substring(0, e.length - 1); return new Date(a) } } return e }, parseEvent: function (e, t, a) { if (e.fRecurrence) { t = t || this.parseDate(e.EventDate, e.fAllDayEvent), a = a || this.parseDate(e.EndDate, e.fAllDayEvent); var n = [], r = ["su", "mo", "tu", "we", "th", "fr", "sa"], D = ["first", "second", "third", "fourth"], s = 0, i = 0; if (-1 != e.RecurrenceData.indexOf("<repeatInstances>") && (s = e.RecurrenceData.substring(e.RecurrenceData.indexOf("<repeatInstances>") + 17), s = parseInt(s.substring(0, s.indexOf("<")))), -1 != e.RecurrenceData.indexOf("<daily ")) { var f = e.RecurrenceData.substring(e.RecurrenceData.indexOf("<daily ")); f = f.substring(7, f.indexOf("/>") - 1); var o = this.formatString(f); if (-1 != o.indexOf("dayFrequency")) for (var g = parseInt(o[o.indexOf("dayFrequency") + 1]), c = !0, d = this.parseDate(e.EventDate, e.fAllDayEvent); c;) { if (i++ , new Date(d).getTime() >= t.getTime()) { var u = new Date(d); u.setSeconds(u.getSeconds() + e.Duration); var l = this.cloneObj(e); l.EventDate = new Date(d), l.EndDate = u, l.fRecurrence = !1, l.Id = e.Id, l.ID = l.Id, n.push(l) } d.setDate(d.getDate() + g), (new Date(d) > a || s > 0 && i >= s) && (c = !1) } else -1 != o.indexOf("weekday") && (e.RecurrenceData = e.RecurrenceData + "<weekly mo='TRUE' tu='TRUE' we='TRUE' th='TRUE' fr='TRUE' weekFrequency='1' />") } if (-1 != e.RecurrenceData.indexOf("<weekly ")) { var f = e.RecurrenceData.substring(e.RecurrenceData.indexOf("<weekly ")); f = f.substring(8, f.indexOf("/>") - 1); for (var o = this.formatString(f), g = parseInt(o[o.indexOf("weekFrequency") + 1]), c = !0, d = this.parseDate(e.EventDate, e.fAllDayEvent), v = d.getDay(); c;) { for (var h = v; 7 > h; h++)if (-1 != o.indexOf(r[h]) && (s > i || 0 == s) && (i++ , new Date(d).getTime() >= t.getTime())) { var y = new Date(d); y.setDate(y.getDate() + (h - v)); var u = new Date(y); u.setSeconds(u.getSeconds() + e.Duration); var l = this.cloneObj(e); l.EventDate = new Date(y), l.EndDate = u, l.fRecurrence = !1, l.Id = e.Id, l.ID = l.Id, n.push(l) } d.setDate(d.getDate() + (7 * g - v)), v = 0, (new Date(d) > a || s > 0 && i >= s) && (c = !1) } } if (-1 != e.RecurrenceData.indexOf("<monthly ")) { var f = e.RecurrenceData.substring(e.RecurrenceData.indexOf("<monthly ")); f = f.substring(9, f.indexOf("/>") - 1); for (var o = this.formatString(f), g = parseInt(o[o.indexOf("monthFrequency") + 1]), c = !0, d = this.parseDate(e.EventDate, e.fAllDayEvent), w = parseInt(o[o.indexOf("day") + 1]); c;) { if (i++ , new Date(d).getTime() >= t.getTime()) { var y = new Date(d); if (y.setDate(w), y.getMonth() == d.getMonth()) { var u = new Date(y); u.setSeconds(u.getSeconds() + e.Duration); var l = this.cloneObj(e); l.EventDate = new Date(y), l.EndDate = u, l.fRecurrence = !1, l.Id = e.Id, l.ID = l.Id, n.push(l) } } d.setMonth(d.getMonth() + g), (new Date(d) > a || s > 0 && i >= s) && (c = !1) } } if (-1 != e.RecurrenceData.indexOf("<monthlyByDay ")) { var f = e.RecurrenceData.substring(e.RecurrenceData.indexOf("<monthlyByDay ")); f = f.substring(14, f.indexOf("/>") - 1); for (var o = this.formatString(f), g = parseInt(o[o.indexOf("monthFrequency") + 1]), c = !0, d = this.parseDate(e.EventDate, e.fAllDayEvent), O = o[o.indexOf("weekdayOfMonth") + 1], x = new Date; c;) { if (i++ , new Date(d).getTime() >= t.getTime()) { var y = new Date(d); if (y.setDate(1), -1 != o.indexOf("weekday")) if (0 == y.getDay() ? y.setDate(y.getDate() + 1) : 6 == y.getDay() && y.setDate(y.getDate() + 2), "last" == O) { for (; y.getMonth() == d.getMonth();)x = new Date(y), y.setDate(5 == y.getDay() ? y.getDate() + 3 : y.getDate() + 1); y = new Date(x) } else for (var h = 0; h < D.indexOf(O); h++)y.setDate(5 == y.getDay() ? y.getDate() + 3 : y.getDate() + 1); else if (-1 != o.indexOf("weekend_day")) if (0 != y.getDay() && 6 != y.getDay() && y.setDate(y.getDate() + (6 - y.getDay())), "last" == O) { for (; y.getMonth() == d.getMonth();)x = new Date(y), y.setDate(0 == y.getDay() ? y.getDate() + 6 : y.getDate() + 1); y = new Date(x) } else for (var h = 0; h < D.indexOf(O); h++)y.setDate(0 == y.getDay() ? y.getDate() + 6 : y.getDate() + 1); else if (-1 != o.indexOf("day")) if ("last" == O) { var y = y.setMonth(y.getMonth() + 1); y.setDate(0) } else y.setDate(y.getDate() + D.indexOf(O)); else { for (var h = 0; h < r.length; h++)-1 != o.indexOf(r[h]) && y.setDate(y.getDay() > h ? y.getDate() + (7 - (y.getDay() - h)) : y.getDate() + (h - y.getDay())); if ("last" == O) { for (; y.getMonth() == d.getMonth();)x = new Date(y), y.setDate(y.getDate() + 7); y = new Date(x) } else for (var h = 0; h < D.indexOf(O); h++)y.setDate(y.getDate() + 7) } if (y.getMonth() == d.getMonth()) { var u = new Date(y); u.setSeconds(u.getSeconds() + e.Duration); var l = this.cloneObj(e); l.EventDate = new Date(y), l.EndDate = u, l.fRecurrence = !1, l.Id = e.Id, l.ID = l.Id, n.push(l) } } d.setMonth(d.getMonth() + g), (new Date(d) > a || s > 0 && i >= s) && (c = !1) } } if (-1 != e.RecurrenceData.indexOf("<yearly ")) { var f = e.RecurrenceData.substring(e.RecurrenceData.indexOf("<yearly ")); f = f.substring(8, f.indexOf("/>") - 1); for (var o = this.formatString(f), g = parseInt(o[o.indexOf("yearFrequency") + 1]), c = !0, d = this.parseDate(e.EventDate, e.fAllDayEvent), p = parseInt(o[o.indexOf("month") + 1]) - 1, w = parseInt(o[o.indexOf("day") + 1]); c;) { var y = new Date(d); if (y.setMonth(p), y.setDate(w), new Date(d).getTime() <= y.getTime() && (i++ , new Date(d).getTime() >= t.getTime())) { var u = new Date(y); u.setSeconds(u.getSeconds() + e.Duration); var l = this.cloneObj(e); l.EventDate = new Date(y), l.EndDate = u, l.fRecurrence = !1, l.Id = e.Id, l.ID = l.Id, n.push(l) } d.setFullYear(d.getFullYear() + g), (new Date(d) > a || s > 0 && i >= s) && (c = !1) } } if (-1 != e.RecurrenceData.indexOf("<yearlyByDay ")) { var f = e.RecurrenceData.substring(e.RecurrenceData.indexOf("<yearlyByDay ")); f = f.substring(13, f.indexOf("/>") - 1); for (var o = this.formatString(f), g = parseInt(o[o.indexOf("yearFrequency") + 1]), c = !0, d = this.parseDate(e.EventDate, e.fAllDayEvent), p = parseInt(o[o.indexOf("month") + 1]) - 1, O = o[o.indexOf("weekdayOfMonth") + 1], w = 0, h = 0; h < r.length; h++)-1 != o.indexOf(r[h]) && "true" == o[o.indexOf(r[h]) + 1].toLowerCase() && (w = h); for (; c;) { var y = new Date(d); if (y.setMonth(p), new Date(d).getTime() <= y.getTime() && (i++ , new Date(d).getTime() >= t.getTime())) { y.setDate(1); var E = y.getDay(); if (y.setDate(E > w ? y.getDate() + (7 - E + w) : y.getDate() + (w - E)), "last" == O) for (var x = new Date(y); x.getMonth() == p;)y = new Date(x), x.setDate(x.getDate() + 7); else y.setDate(y.getDate() + 7 * D.indexOf(O)); if (y.getMonth() == p) { var u = new Date(y); u.setSeconds(u.getSeconds() + e.Duration); var l = this.cloneObj(e); l.EventDate = new Date(y), l.EndDate = u, l.fRecurrence = !1, l.Id = e.Id, l.ID = l.Id, n.push(l) } } d.setFullYear(d.getFullYear() + g), d.setMonth(p), d.setDate(1), (new Date(d) > a || s > 0 && i >= s) && (c = !1) } } return n } return e.EventDate = new Date(this.parseDate(e.EventDate, e.fAllDayEvent)), e.EndDate = new Date(this.parseDate(e.EndDate, e.fAllDayEvent)), [e] }, cloneObj: function (e) { var t; if (null == e || "object" != typeof e) return e; if (e instanceof Date) return t = new Date, t.setTime(e.getTime()), t; if (e instanceof Array) { t = []; for (var a = 0, n = e.length; n > a; a++)t[a] = this.cloneObj(e[a]); return t } if (e instanceof Object) { t = {}; for (var r in e) e.hasOwnProperty(r) && (t[r] = this.cloneObj(e[r])); return t } throw new Error("Unable to copy obj! Its type isn't supported.") } };
var eventResults = data.d.results;
var parsedArray = spEventsParser.parseEvents(eventResults);

var today = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate());
var d = today.getDay(),
    diff = today.getDate() - d + (d == 0 ? -6 : 1);
var startOfWeek = new Date(today.setDate(diff));
var endOfWeek = new Date();
endOfWeek = new Date(endOfWeek.setDate(startOfWeek.getDate() + 6));
var _ = shortpoint.base.libs._;
var filteredData = _.filter(parsedArray, function (data) {
    return data.EventDate >= startOfWeek && data.EventDate <= endOfWeek;
});
var sortedData = _.sortBy(filteredData, function (a) {
    return a.EventDate;
});


var $ = shortpoint.$;
currentSite = window.location.protocol + "//" + window.location.host + _spPageContextInfo.webServerRelativeUrl;
TimeZone = {};
 $.ajax({
            url: currentSite + "/_api/Web/RegionalSettings/TimeZone",
            method: "GET",
      async: false,
            headers: { "Accept": "application/json; odata=verbose" },
        }).done(function (response) {
      TimeZone = response.d;
            sortedData.forEach(function(item, index){
        //var d = this.EventDate;
        var localTime = item.EventDate.getTime();
        var localEndTime = item.EndDate.getTime();
        var regionTimeoffset = (TimeZone.Information.Bias + TimeZone.Information.DaylightBias) * 60000;
        var localTimeoffset =  item.EventDate.getTimezoneOffset() * 60000;
        item.EventDate = new Date();
        item.EventDate.setTime(localTime + ((localTimeoffset - regionTimeoffset )));
        item.EndDate = new Date();
        item.EndDate.setTime(localEndTime + ((localTimeoffset - regionTimeoffset )));
        if(item.RecurrenceData != null){
          var instnaceDate = new Date();
          instnaceDate.setTime(localTime );
          item.DisplayId = item.Id + ".0."+ instnaceDate.toISOString().replace(".000Z","Z") ;
        }else{
          item.DisplayId = item.Id;
        }
        });
        return sortedData;
        });   
return sortedData;
        



Click on Connect 


Step 4: Map Columns


In the Items tab, map the columns the way you want:



Display events form in a pop-up (Optional):


Map the url to the display form of the event and then add #Id in the Link field and select lightbox in Linking options


<https://your-site>/Lists/<Events List Title>/DispForm.aspx?ID=#DisplayId


<https://your-site>: Replace with your site URL (for example https://contoso.sharepoint.com)

<Events List Title>: Replace with title of your events list (for example Events)


Example URL: https://contoso.sharepoint.com/Lists/Events/DispForm.aspx?ID=



Click Insert + and you are done!


Now you can see the Events ShortPoint Element with the occurrence(s)!