小编shu*_*uwi的帖子

Node.js。忙查询中缺少timeMin参数。Google Calendar API

我正在尝试在Node.js中使用google-api-nodejs-client。我timeMinfreebusy查询中的参数格式有问题。根据docs,值应为ISO格式的timedate。我试过了,但出现错误。在该event.list方法中,ISO格式字符串可以正常工作。

查询freebusy代码:

function freeBusyStatus (auth, calendarId) {
    const startDate = new Date('20 February 2018 12:00').toISOString()
    const endDate = new Date('20 February 2018 13:00').toISOString()
    const check = {
        auth: auth,
        // timeMin: '2018-02-20T12:00:00+03:00', //not working with same format too
        timeMin: new Date('20 February 2018 12:00'),
        timeMax: endDate,
        items: [{id: calendarId}]
    }
    calendar.freebusy.query (check, function (err, response) {
        if (err) {
            console.log ('error: ' + err)
        } else {
            ..some code..
        } …
Run Code Online (Sandbox Code Playgroud)

javascript google-calendar-api google-api-nodejs-client

1
推荐指数
1
解决办法
475
查看次数