Returning single instance events when no recurring

This commit is contained in:
Sébastien Levert 2020-11-01 15:31:56 -05:00
parent 3d0e617e5b
commit aff8e71649
1 changed files with 12 additions and 4 deletions

View File

@ -308,11 +308,19 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
if (this.props.showRecurrence) { if (this.props.showRecurrence) {
//Get recurring events and merge with the other (standard) events //Get recurring events and merge with the other (standard) events
this._getRecurringMaster(startDate, endDate).then((recData: Array<EventInput>) => { this._getRecurringMaster(startDate, endDate).then((recData: Array<EventInput>) => {
if(recData.length > 0) {
this._getRecurrentEvents(recData, startDate, endDate).then((recEvents: Array<EventInput>) => { this._getRecurrentEvents(recData, startDate, endDate).then((recEvents: Array<EventInput>) => {
this.setState({ this.setState({
events: [...recEvents, ...events].slice(0, this.props.limit), events: [...recEvents, ...events].slice(0, this.props.limit),
}); });
}); });
} else {
this.setState({
events: events,
});
}
}); });
} else { } else {
//Show only (standard) events //Show only (standard) events