Parsing the timetable is a bit more complex than just fetching it and sorting it by date.
PRONOTE can have superposed classes, canceled classes, planned classes, etc. so if you want to exactly reproduce the PRONOTE timetable, you will have to parse it.
This is not the default behavior and you should call a function to do this.
Some people wouldn't want this behavior so it's up to you to decide, it all depends on what you want to do.
/// ... create a session and login and get the timetablepronote.parseTimetable(session, timetable, { withSuperposedCanceledClasses: false, withCanceledClasses: true, withPlannedClasses: true});// ... console.log() the lessons
If we check the output for the day 11/09/2023, we should see something like this:
11/09/2023 09:00:00 | LESSON: FRANCAIS11/09/2023 10:00:00 | LESSON: HISTOIRE-GÉOGRAPHIE11/09/2023 11:00:00 | LESSON: MATHÉMATIQUES11/09/2023 13:30:00 | LESSON: SCIENCES DE LA VIE ET DE LA TERRE11/09/2023 13:30:00 | DETENTION: Retenue 13h30 - 14h3011/09/2023 14:30:00 | LESSON: ANGLAIS LV111/09/2023 15:30:00 | LESSON: ÉDUCATION PHYSIQUE ET SPORTIVE
Let's compare with the official PRONOTE application:
As you can see, the MATHÉMATIQUES lesson is kept since we enabled the withCanceledClasses option.
Note that the lesson behind the DETENTION - this one:
is not present in the output because we disabled the withSuperposedCanceledClasses option.