Calendar API V3 doesn't respect timeMin timeMax parameters in nodejs Express application
See original GitHub issueI’ve managed to get all events between two dates as mentioned in quickstart example on pure nodeJs environment.
But when i use same cording with nodeJs Express App, It doesn’t respect the timeMin and timeMax parameters.
Instead, i get all the events from the date that i created first event on calendar. Here is my code block looks like.
function listEvents(auth) {
var calendar = google.calendar('v3');
calendar.events.list({
auth: auth,
calendarId: 'primary',
timeMin: (new Date(Date.parse("2018-01-22"))).toISOString(),
timeMax: (new Date(Date.parse("2018-02-27"))).toISOString(),
singleEvents: true,
orderBy: 'startTime'
}, function(err, response) {
if (err) {
console.log('The API returned an error: ' + err);
return;
}
var events = response.items;
if (events.length === 0) {
console.log('No upcoming events found.');
}
else {
// Do Some Stuff ...............
}
});
}
What am i missing here…?
Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Google Calendar API V3 doesn't respect timeMin timeMax ...
But when i use same cording with nodeJs Express App, It doesn't respect the timeMin and timeMax parameters. Instead, i get all the...
Read more >Google Calendar API V3 doesn't respect timeMin timeMax ...
Coding example for the question Google Calendar API V3 doesn't respect timeMin timeMax parameters in nodejs Express application-node.js.
Read more >How to integrate Google Calendar in Node.js ? - GeeksforGeeks
This article covers the integration of Google Calendar API in the NodeJS application and creating new events with service account ...
Read more >ExpressJS with the Google Calendar API - Kaz Yamada
Install ExpressJS and dotenv save it in the dependencies list. CLI. npm install express dotenv. Create an entry file index.js ...
Read more >Calendar - googleapis documentation
File. src/apis/calendar/v3.ts. Description. Calendar API. Manipulates events and other calendar data. const {google} = require('googleapis'); const calendar ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The starter example seems to be incorrect, but in line with the documentation.
V0.x of the
google-auth-library
uses the request library, so passing a querystring options does the trick:The solution proposed in 946, however, is the more correct one, since it uses v1 of the
google-auth-library
which has changed the dependency onrequest
for axiosNVM I remedied this issue by switching to async await calls instead of using sync. It looks like in v30 at least, qs and params are not used; params are passed directly into the function as an object argument.
var events = await calendar.events.list({ calendarId: 'secret', timeMin: currentdate.toISOString(), timeMax: nextWeekDate.toISOString(), singleEvents: true });