.getStartTime()不是函数? [英] .getStartTime() not a function?

查看:132
本文介绍了.getStartTime()不是函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何让.getStartTime工作?
我正在使用CalendarEvent类,并且.getStartTime列在此类下( https://developers.google.com/apps-script/reference/calendar/calendar-event#getStartTime())
但是当我尝试运行以下代码时,我得到了TypeError: Cannot find function getStartTime in object CalendarEvent.

how do i get .getStartTime to work?
i'm using the CalendarEvent class, and .getStartTime is listed under this class (https://developers.google.com/apps-script/reference/calendar/calendar-event#getStartTime())
but when i try to run the following code, i get TypeError: Cannot find function getStartTime in object CalendarEvent.

function test() {
  var TA =CalendarApp.getCalendarsByName("CalendarName")[0].getEvents(startDt, endDt);
  var starting = TA.getStartTime();
  Logger.log(starting);
  return;
};

我在做什么错?我想不通,我在网上找到的所有教程都表明应该可以.

what am i doing wrong? i can't figure it out, all the tutorials i found online indicates that this should work.

推荐答案

查看

Looking at getEvents(Date,Date) it returns CalendarEvent[] .

因此,您试图在整个数组上而不是特定的CalendarEvent对象上调用方法.

So , you're trying to call a method on an entire array, instead of a particular CalendarEvent object.

只需使用TA[0].getStartTime()或您想要的任何事件.

Simply use TA[0].getStartTime() or whichever event you'd like.

这篇关于.getStartTime()不是函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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