我正在尝试在Node.js中使用google-api-nodejs-client。我timeMin在freebusy查询中的参数格式有问题。根据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)