format document

This commit is contained in:
Abderahman88 2020-10-27 20:07:31 +01:00
parent 0996e86163
commit 79ccdbf5db
1 changed files with 22 additions and 22 deletions

View File

@ -252,20 +252,20 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
//Check if both ranges overlap //Check if both ranges overlap
if (!!r1.overlaps(r2)) { if (!!r1.overlaps(r2)) {
events.push({ events.push({
id: item.id, id: item.id,
title: item.subject, title: item.subject,
// If the event is an All Day event, add 1 day without Timezone to the start date // If the event is an All Day event, add 1 day without Timezone to the start date
start: !item.isAllDay ? currentStartDate.clone().tz(Intl.DateTimeFormat().resolvedOptions().timeZone).format() : moment(currentStartDate).add(1, 'd').toISOString(), start: !item.isAllDay ? currentStartDate.clone().tz(Intl.DateTimeFormat().resolvedOptions().timeZone).format() : moment(currentStartDate).add(1, 'd').toISOString(),
// If the event is an All Day event, add 1 day without Timezone to the end date // If the event is an All Day event, add 1 day without Timezone to the end date
end: !item.isAllDay ? currentEndDate.clone().tz(Intl.DateTimeFormat().resolvedOptions().timeZone).format() : moment(currentEndDate).add(1, 'd').toISOString(), end: !item.isAllDay ? currentEndDate.clone().tz(Intl.DateTimeFormat().resolvedOptions().timeZone).format() : moment(currentEndDate).add(1, 'd').toISOString(),
allDay: item.isAllDay, allDay: item.isAllDay,
location: item.location.displayName, location: item.location.displayName,
body: item.bodyPreview, body: item.bodyPreview,
type: item.type type: item.type
}); });
} }
}); });
return events; return events;
} }
@ -320,7 +320,7 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
events: events, events: events,
}); });
} }
// Sets the state with current active calendar dates // Sets the state with current active calendar dates
this.setState({ this.setState({
currentActiveStartDate: startDate, currentActiveStartDate: startDate,
@ -332,12 +332,12 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
} }
} }
/** /**
* Get all recurrent events based on the current state of the Calendar * Get all recurrent events based on the current state of the Calendar
* @param events All the recurrent base events * @param events All the recurrent base events
* @param startDate The first visible date on the calendar * @param startDate The first visible date on the calendar
* @param endDate The last visible date on the calendar * @param endDate The last visible date on the calendar
*/ */
private _getRecurrentEvents(events: Array<EventInput>, startDate: Date, endDate: Date): Promise<Array<EventInput>> { private _getRecurrentEvents(events: Array<EventInput>, startDate: Date, endDate: Date): Promise<Array<EventInput>> {
return new Promise<Array<EventInput>>((resolve, reject) => { return new Promise<Array<EventInput>>((resolve, reject) => {
this.props.context.msGraphClientFactory this.props.context.msGraphClientFactory
@ -347,7 +347,7 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
var count = 0; var count = 0;
events.map((item: any) => { events.map((item: any) => {
let apiUrl: string = `/groups/${this.state.groupId}/events/${item.id}/instances?startDateTime=${startDate.toISOString()}&endDateTime=${endDate.toISOString()}`; let apiUrl: string = `/groups/${this.state.groupId}/events/${item.id}/instances?startDateTime=${startDate.toISOString()}&endDateTime=${endDate.toISOString()}`;
if(this._isPersonalTab()) { if (this._isPersonalTab()) {
apiUrl = `/me/events/${item.id}/instances?startDateTime=${startDate.toISOString()}&endDateTime=${endDate.toISOString()}`; apiUrl = `/me/events/${item.id}/instances?startDateTime=${startDate.toISOString()}&endDateTime=${endDate.toISOString()}`;
} }
client client
@ -382,7 +382,7 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
.getClient() .getClient()
.then((client: MSGraphClient): void => { .then((client: MSGraphClient): void => {
let apiUrl: string = `/groups/${this.state.groupId}/events`; let apiUrl: string = `/groups/${this.state.groupId}/events`;
if(this._isPersonalTab()) { if (this._isPersonalTab()) {
apiUrl = '/me/events'; apiUrl = '/me/events';
} }
client client