2017-04-11 97 views
0

我希望获得用户日历的默认IANA时区(与其他人不同,或者this可以正常工作)。如何从Google Calendar API获取用户日历默认IANA时区?

我相信这样做的方式可能与Settings timezone来获得时间,但文档似乎并没有涵盖这个具体的JavaScript。

这是我的尝试,这是由谷歌的文档herehere的搭配灵感:

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); 
}); 

这无奈只能给我的window.gapi.client.calendar.get is not a function错误。

我已经在我的项目中使用window.gapi.client.calendar.events.insert,window.gapi.client.calendar.events.updatewindow.gapi.client.calendar.events.list,所以它不应该是window.gapi.client.calendar这是问题。

有没有人有任何猜测如何得到这个?

回答

0

我注意到,您使用的成功调用始终包含events对象。我想你应该使用events.get,就像你对events.list。,events.insertevents.update所做的一样。

window.gapi.client.calendar.get 

变化:

window.gapi.client.calendar.events.get 
+0

感谢您的答复。事件对象允许我访问事件本身的信息,但由于我试图访问日历的设置而不是任何特定的事件,我也尝试过'window.gapi.client.calendar.settings.get',但是徒劳无功。 – Rbar

+0

使用window.gapi.client.calendar.settings.get时会得到什么错误响应? – noogui

+0

'未捕获的类型错误:无法读取未定义的属性'设置' – Rbar

相关问题