Fix timezones being returned from office 365 (#1269)
Per the [api documentation](https://docs.microsoft.com/en-us/graph/api/calendar-list-calendarview?view=graph-rest-1.0&tabs=javascript#query-parameters) the `Prefer: outlook.timezone` is ignored if a timezone value is passed in the request. This forces the dates to be passed in UTC. Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
parent
c1d90eb438
commit
3ff99f7877
1 changed files with 6 additions and 6 deletions
|
@ -115,9 +115,12 @@ export const Office365CalendarApiAdapter = (credential: Credential): CalendarApi
|
||||||
|
|
||||||
return {
|
return {
|
||||||
getAvailability: (dateFrom, dateTo, selectedCalendars) => {
|
getAvailability: (dateFrom, dateTo, selectedCalendars) => {
|
||||||
const filter = `?startdatetime=${encodeURIComponent(dateFrom)}&enddatetime=${encodeURIComponent(
|
const dateFromParsed = new Date(dateFrom);
|
||||||
dateTo
|
const dateToParsed = new Date(dateTo);
|
||||||
)}`;
|
|
||||||
|
const filter = `?startdatetime=${encodeURIComponent(
|
||||||
|
dateFromParsed.toISOString()
|
||||||
|
)}&enddatetime=${encodeURIComponent(dateToParsed.toISOString())}`;
|
||||||
return auth
|
return auth
|
||||||
.getToken()
|
.getToken()
|
||||||
.then((accessToken) => {
|
.then((accessToken) => {
|
||||||
|
@ -138,9 +141,6 @@ export const Office365CalendarApiAdapter = (credential: Credential): CalendarApi
|
||||||
const requests = ids.map((calendarId, id) => ({
|
const requests = ids.map((calendarId, id) => ({
|
||||||
id,
|
id,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
|
||||||
Prefer: 'outlook.timezone="Etc/GMT"',
|
|
||||||
},
|
|
||||||
url: `/me/calendars/${calendarId}/calendarView${filter}`,
|
url: `/me/calendars/${calendarId}/calendarView${filter}`,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue