我正在尝试使用 Google 日历 API 方法gapi.client.calendar.events.list https://developers.google.com/google-apps/calendar/v3/reference/events/list检索日历上的事件now.
我可以成功过滤开始日期和结束日期。但是,如果事件昨天开始并且仍在进行中,那么过滤今天开始的事件对我没有帮助。
var request = gapi.client.calendar.events.list({
'calendarId': 'my calendar id',
// shows things that have not yet started
'timeMin': (new Date()).toISOString(),
'showDeleted': false,
'singleEvents': true,
'orderBy': 'startTime'
});
如何在日历上查找当前正在进行的事情列表?
我(显然)希望避免拉出一周的事件并对其进行解析。
没有直接查询当前事件的方法,但您当然可以给它一个有限的最短和最长时间,因此您只能搜索少量事件。如果您的活动是有规律的并且持续时间可预测,您也许可以让它只给您一个。
events = client.events().list(calendarId='primary',
timeMin='2011-12-22T09:00:00Z',
timeMax='2011-12-22T22:00:00Z').execute()
更多信息请阅读Google Calendar API官方文档:https://developers.google.com/google-apps/calendar/?csw=1 https://developers.google.com/google-apps/calendar/?csw=1
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)