📜  CalendarApp.newRecurrence - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:26.750000             🧑  作者: Mango

代码示例1
function createRecurringEvent() {
  const Tstart = new Date('December 5, 2020 04:00:00 PM EST');
  const Tstop = new Date('December 5, 2020 05:00:00 PM EST');
  const CEUntil = new Date('January 10, 2021');
  
  const recurrence = CalendarApp.newRecurrence()
  const rule = recurrence.addWeeklyRule().until(CEUntil);
  
  const exceptions = [ 'December 5, 2020', 'December 26, 2020' ];
  exceptions.forEach(function(exception) {
    rule.addDateExclusion(new Date(exception));
  });
  
  CalendarApp.getDefaultCalendar().createEventSeries(
    'Recurring Event',
    Tstart,
    Tstop,
    recurrence
  );
}