Google Apps脚本日历服务:仅获取所有重复(全天)事件中的第一个事件 [英] Google Apps Script Calendar Service: Get only the first events of all recurring (all day) events

查看:56
本文介绍了Google Apps脚本日历服务:仅获取所有重复(全天)事件中的第一个事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了

In addition to this question I'd like to ask how to efficiently retrieve only the first events of all recurring (all day) events. To call the function findFirstEvent() for each single event seems not to be reasonable. So my approach would be to filter the array of all events.

var cal=CalendarApp.getCalendarById("Calendar Id");
var startTime=new Date(1850,0,1);
var endTime=new Date();
var events=cal.getEvents(startTime, endTime);
var firstEvents=events.filter(onlyFirstEvents);

function onlyFirstEvents() {
    ...
}

最后,我实际上需要的是一个数组,以事件标题为键,而 Date 对象为值.

What I actually need in the end is an array with the event titles as keys and Date objects as values.

推荐答案

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆