From 8da05525418eb14531018b1ca70e1769319b01d7 Mon Sep 17 00:00:00 2001 From: netaskd Date: Thu, 13 Jun 2019 14:08:46 +0300 Subject: [PATCH] microsoftCalendar: add showing calendar events in local timezone. --- package.json | 1 + react/features/calendar-sync/web/microsoftCalendar.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/package.json b/package.json index c585201d2..91cf0a953 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/react/features/calendar-sync/web/microsoftCalendar.js b/react/features/calendar-sync/web/microsoftCalendar.js index 167cb09f7..9ab3eaefe 100644 --- a/react/features/calendar-sync/web/microsoftCalendar.js +++ b/react/features/calendar-sync/web/microsoftCalendar.js @@ -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()