microsoftCalendar: add showing calendar events in local timezone.

This commit is contained in:
netaskd 2019-06-13 14:08:46 +03:00 committed by Дамян Минков
parent 7ce0def995
commit 8da0552541
2 changed files with 7 additions and 0 deletions

View File

@ -85,6 +85,7 @@
"redux-thunk": "2.2.0",
"styled-components": "3.4.9",
"uuid": "3.1.0",
"windows-iana": "^3.1.0",
"xmldom": "0.1.27"
},
"devDependencies": {

View File

@ -12,6 +12,8 @@ import { getShareInfoText } from '../../invite';
import { setCalendarAPIAuthState } from '../actions';
import { findWindows } from 'windows-iana';
/**
* Constants used for interacting with the Microsoft API.
*
@ -560,9 +562,13 @@ function requestCalendarEvents( // eslint-disable-line max-params
startDate.toISOString()}' and End/DateTime lt '${
endDate.toISOString()}'`;
const ianaTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
const windowsTimeZone = findWindows(ianaTimeZone);
return client
.api(`/me/calendars/${calendarId}/events`)
.filter(filter)
.header('Prefer', `outlook.timezone="${windowsTimeZone}"`)
.select('id,subject,start,end,location,body')
.orderby('createdDateTime DESC')
.get()