Przeglądaj źródła

microsoftCalendar: add showing calendar events in local timezone.

j8
netaskd 6 lat temu
rodzic
commit
8da0552541

+ 1
- 0
package.json Wyświetl plik

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

+ 6
- 0
react/features/calendar-sync/web/microsoftCalendar.js Wyświetl plik

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

Ładowanie…
Anuluj
Zapisz