Coder Social home page Coder Social logo

Comments (5)

andreafrati1969 avatar andreafrati1969 commented on August 19, 2024

Occorre modificare il metodo agenda per usare family_base_url invece di base_url

from classevivaapi.

Giuliopime avatar Giuliopime commented on August 19, 2024

Non funziona comunque purtroppo

Questo è quello che ho provato:

let today = new Date();
let day = today.getDate();
let month = today.getMonth();
let from = new Date(2020, month, day, 8, 0, 0, 0)
let to = new Date(2020, month, day, 16, 0, 0, 0)
sessione.agenda(from, to)
    .then(agenda=>{
          console.log(agenda)
    }) 

Il console.log logga null

this.agenda = (start, end) => {
     return this.request(this.family_base_url + 'agenda_studenti.php?ope=get_events&classe_id=&gruppo_id=&start=' + start + '&end=' + end)
         .then(res => {
             try {
                 return JSON.parse(res);
             } catch (err) {
                 throw new Error('Invalid or expired session ID')
             }
         })
 };

Queste sono le timestamp che passo ad Agenda per esempio:
Thu May 21 2020 08:00:00 GMT+0200 (GMT+02:00) Thu May 21 2020 16:00:00 GMT+0200 (GMT+02:00)

from classevivaapi.

andreafrati1969 avatar andreafrati1969 commented on August 19, 2024

Prova così, lo start e l'end sono secondi per cui devi dividere per 1000 quanto ritornato dal metodo Date.getTime().
var d = new Date('2020-05-01T00:00:00.000Z').getTime() / 1000;
session.agenda(d, d).then(agenda => {
console.log(agenda);
})

from classevivaapi.

Giuliopime avatar Giuliopime commented on August 19, 2024

Funziona, grazie mille per il chiarimento, spero possa essere utile anche ad altri.

from classevivaapi.

Giuliopime avatar Giuliopime commented on August 19, 2024

Altre due domande scusa:

  • quando uso il metodo grades, esso mi ritorna un oggetto vuoto
  • quando do in input al metodo agenda una data futura, quindi ad esempio il giorno sucessivo, mi da errore, il return è null inoltre a volte non vengono ritornati tutti i compiti/note

from classevivaapi.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.