Skip to content

Commit

Permalink
fixed builderror with optional type
Browse files Browse the repository at this point in the history
  • Loading branch information
md committed Nov 22, 2024
1 parent cec4fdc commit d6b6255
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frontend/src/api-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface BookingDetails {
/** @format int32 */
projectId: number;
isBillable: boolean;
endDateAgreement: string | null;
endDateAgreement?: string | null;
}

export enum BookingType {
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/components/Staffing/DetailedBookingRows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export function DetailedBookingRows(props: {

async function getColorIcon() {
const endDateString = detailedBooking.bookingDetails.endDateAgreement;
if (endDateString !== null) {
if (endDateString && endDateString !== null) {
const endDate = new Date(endDateString).getTime();

const today = new Date().getTime();
Expand All @@ -123,7 +123,9 @@ export function DetailedBookingRows(props: {
return setAlertColor(colors.find((c) => c.color == "green"));
}
} else {
return setAlertColor(colors.find((c) => c.color == "red"));
if (endDateString === null) {
return setAlertColor(colors.find((c) => c.color == "red"));
}
}
}

Expand Down

0 comments on commit d6b6255

Please sign in to comment.