Browse Source

microsoftCalendar: add showing calendar events in local timezone.

master
netaskd 5 years ago
parent
commit
8da0552541
2 changed files with 7 additions and 0 deletions
  1. 1
    0
      package.json
  2. 6
    0
      react/features/calendar-sync/web/microsoftCalendar.js

+ 1
- 0
package.json View File

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

+ 6
- 0
react/features/calendar-sync/web/microsoftCalendar.js View File

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

Loading…
Cancel
Save