Skip to content
This repository was archived by the owner on Aug 30, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/services/pronote/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,20 @@ export const getMenu = async (account: PronoteAccount, date: Date): Promise<Menu
}

const menu = await pronote.menus(account.instance, date);
if (!menu.days || menu.days.length === 0) {
if (!menu.days?.length) {
return { date };
}

const day = menu.days[0];

if (day.date?.getTime() !== date.getTime()) {
const updatedDate = new Date(day.date);
updatedDate.setDate(updatedDate.getDate() + 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Est-ce qu'en faisant ceci, ça a une influence ?

Suggested change
updatedDate.setDate(updatedDate.getDate() + 1);
updatedDate.setUTCDate(updatedDate.getUTCDate() + 1);

updatedDate.setUTCHours(0, 0, 0, 0);

const targetDate = new Date(date);
targetDate.setUTCHours(0, 0, 0, 0);

if (updatedDate.getTime() !== targetDate.getTime()) {
return { date };
}

Expand Down
Loading