0

I would like to get the default IANA time zone of a user's calendar (which is not necessarily the same timezone that the person as in--or else this would work fine).

I believe the way to do this may be with Settings timezone to get the time, but the documentation does not seem to cover javascript for this specifically.

This is my attempt, which is inspired by a mix of google's docs here and here:

var timeZoneCalendar = window.gapi.client.calendar.get({
  resourceName: '/users/me/settings/timeZoneId'
}).then(function(response) {
  console.log(response.result);
}, function(reason) {
  console.log('Error: ' + reason.result.error.message);
});

This unfortunately only gives me the error of window.gapi.client.calendar.get is not a function.

I already use the window.gapi.client.calendar.events.insert, window.gapi.client.calendar.events.update, and window.gapi.client.calendar.events.list in my project so it shouldn't be the window.gapi.client.calendar that is the issue.

Does anyone have any guesses on how to get this?

Community
  • 1
  • 1
Rbar
  • 3,740
  • 9
  • 39
  • 69

1 Answers1

0

I noticed that the successful calls you were using always included events object. I think you should use events.get as well like what you did with events.list., events.insert and events.update.

window.gapi.client.calendar.get

change to:

window.gapi.client.calendar.events.get
ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56
  • thanks for the reply. The events object allows me to access information for the events themselves, but since I am trying to access the Settings of the calendar rather than any particular event, I also tried `window.gapi.client.calendar.settings.get`, but to no avail. – Rbar Apr 12 '17 at 18:37
  • What error response do you get when using window.gapi.client.calendar.settings.get? – ReyAnthonyRenacia Apr 13 '17 at 04:16
  • `Uncaught TypeError: Cannot read property 'settings' of undefined` – Rbar Apr 16 '17 at 15:18