Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

150
Views
API DE CALENDARIO: la lista de eventos es diferente cada vez que la ejecuto

Tengo un problema, cada vez que ejecuto mi código para recuperar la lista de calendario, luego mis eventos.

la lista del calendario es siempre la misma, sin embargo, el número de eventos es diferente cada vez que ejecuto el código.

hay una fecha de inicio y una fecha de finalización, aquí está mi código.

 // Make sure the client is loaded and sign-in is complete before calling this method. function execute() { return gapi.client.calendar.calendarList.list({}) .then(function(response) { // Handle the results here (response.result has the parsed body). let data = JSON.parse(response.body); for (let i = 0; i < data.items.length; i++) { let calendar_id = data.items[i].id; getEvents(calendar_id, function() { if(i == data.items.length -1) { addInvoices(Invoices); console.log(Invoices); } }); }; }, function(err) { console.error("Execute error", err); }); } function getEvents(calendar_id, callback) { let start_date = new Date($('#start_date').val()); let end_date = new Date($('#end_date').val()); console.log(start_date); console.log(end_date); return gapi.client.calendar.events.list({ 'calendarId': calendar_id, 'timeMax': end_date.toISOString(), 'timeMin': start_date.toISOString(), 'showDeleted': false, 'singleEvents': true, 'orderBy': 'startTime' }) .then(function(response) { // Handle the results here (response.result has the parsed body). let events = response.result.items; for(let m = 0; m < events.length; m++) { if(!Invoices.includes(events[m]) ) Invoices.push(events[m]); } callback(); return events; }, function(err) { console.error("Execute error", err);}); } gapi.load("client:auth2", function() { gapi.auth2.init({client_id: "{{ $currentCompany->getSetting('client_id') ? $currentCompany->getSetting('client_id') : '' }}"}); }); ``` Do you have any idea why i got this issue ?
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Solucionado, el error estaba en mi controlador ajax.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!