Skip to content

Commit

Permalink
patch dayLabel missing
Browse files Browse the repository at this point in the history
  • Loading branch information
raphckrman committed May 9, 2024
1 parent 0ef36b0 commit 43a6144
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8,240 deletions.
15 changes: 10 additions & 5 deletions lib/api/bookingGet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,18 @@ export const getBookingWeek = async (token: string, id: number, weekNumber?: num

let days = await Promise.all(terminal.jours.map(async (day) => {
let month = weekDate.getMonth();
let dayNumber = parseInt(day.dayLabel.split(" ")[1])+1;
let firstDayOfWeek = parseInt(terminal.jours[0].dayLabel.split(" ")[1]);
if (day.dayLabel) {
let dayNumber = parseInt(day.dayLabel.split(" ")[1])+1;
let firstDayOfWeek = terminal.jours[0]?.dayLabel ? parseInt(terminal.jours[0].dayLabel.split(" ")[1]) : 0;

if (firstDayOfWeek > dayNumber) {
month = month+1;
if (firstDayOfWeek > dayNumber) {
month = month+1;
}
var date = new Date(weekDate.getFullYear(), month, dayNumber);
}
else {
var date = new Date(weekDate.getFullYear(), weekDate.getMonth(), day.dayOfWeek);
}
let date = new Date(weekDate.getFullYear(), month, dayNumber);

return new BookingDay(
token,
Expand Down
2 changes: 1 addition & 1 deletion lib/interfaces/Bookings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface DayBooking {
},
autorise: boolean,
msg: string,
dayLabel: string
dayLabel?: string
}

export interface BookingPrice {
Expand Down
Loading

0 comments on commit 43a6144

Please sign in to comment.