我希望获得用户日历的默认IANA时区(与其他人不同,或者this可以正常工作)。如何从Google Calendar API获取用户日历默认IANA时区?
我相信这样做的方式可能与Settings timezone
来获得时间,但文档似乎并没有涵盖这个具体的JavaScript。
这是我的尝试,这是由谷歌的文档here和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);
});
这无奈只能给我的window.gapi.client.calendar.get is not a function
错误。
我已经在我的项目中使用window.gapi.client.calendar.events.insert
,window.gapi.client.calendar.events.update
和window.gapi.client.calendar.events.list
,所以它不应该是window.gapi.client.calendar
这是问题。
有没有人有任何猜测如何得到这个?
感谢您的答复。事件对象允许我访问事件本身的信息,但由于我试图访问日历的设置而不是任何特定的事件,我也尝试过'window.gapi.client.calendar.settings.get',但是徒劳无功。 – Rbar
使用window.gapi.client.calendar.settings.get时会得到什么错误响应? – noogui
'未捕获的类型错误:无法读取未定义的属性'设置' – Rbar