From edbcef698c872038c77150f06792e7dd034ae9ea Mon Sep 17 00:00:00 2001 From: Arnei Date: Wed, 6 Mar 2024 11:56:44 +0100 Subject: [PATCH] Fix typing issues from utils Merging too many different PRs introducing types caused issues. My bad. This resolves that. --- .../EventDetailsSchedulingTab.tsx | 24 +++++++++---------- app/src/utils/utils.ts | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/src/components/events/partials/ModalTabsAndPages/EventDetailsSchedulingTab.tsx b/app/src/components/events/partials/ModalTabsAndPages/EventDetailsSchedulingTab.tsx index f5fc53ef03..80ba7edfa6 100644 --- a/app/src/components/events/partials/ModalTabsAndPages/EventDetailsSchedulingTab.tsx +++ b/app/src/components/events/partials/ModalTabsAndPages/EventDetailsSchedulingTab.tsx @@ -212,13 +212,13 @@ const EventDetailsSchedulingTab = ({ return { scheduleStartDate: startDate.setHours(0, 0, 0), - scheduleStartHour: makeTwoDigits(source.start.hour), - scheduleStartMinute: makeTwoDigits(source.start.minute), - scheduleDurationHours: makeTwoDigits(source.duration.hour), - scheduleDurationMinutes: makeTwoDigits(source.duration.minute), + scheduleStartHour: source.start.hour ? makeTwoDigits(source.start.hour) : "", + scheduleStartMinute: source.start.minute ? makeTwoDigits(source.start.minute) : "", + scheduleDurationHours: source.duration.hour ? makeTwoDigits(source.duration.hour) : "", + scheduleDurationMinutes: source.duration.minute ? makeTwoDigits(source.duration.minute): "", scheduleEndDate: endDate.setHours(0, 0, 0), - scheduleEndHour: makeTwoDigits(source.end.hour), - scheduleEndMinute: makeTwoDigits(source.end.minute), + scheduleEndHour: source.end.hour ? makeTwoDigits(source.end.hour): "", + scheduleEndMinute: source.end.minute ? makeTwoDigits(source.end.minute): "", captureAgent: source.device.name, inputs: inputs.filter((input) => input !== ""), }; @@ -403,8 +403,8 @@ const EventDetailsSchedulingTab = ({ )} {!hasAccessRole && ( - {makeTwoDigits(source.start.hour)}: - {makeTwoDigits(source.start.minute)} + {source.start.hour ? makeTwoDigits(source.start.hour) : ""}: + {source.start.minute ? makeTwoDigits(source.start.minute) : ""} )} @@ -477,8 +477,8 @@ const EventDetailsSchedulingTab = ({ )} {!hasAccessRole && ( - {makeTwoDigits(source.duration.hour)}: - {makeTwoDigits(source.duration.minute)} + {source.duration.hour ? makeTwoDigits(source.duration.hour) : ""}: + {source.duration.minute ? makeTwoDigits(source.duration.minute): ""} )} @@ -566,8 +566,8 @@ const EventDetailsSchedulingTab = ({ )} {!hasAccessRole && ( - {makeTwoDigits(source.end.hour)}: - {makeTwoDigits(source.end.minute)} + {source.end.hour ? makeTwoDigits(source.end.hour) : ""}: + {source.end.minute ? makeTwoDigits(source.end.minute): ""} {formik.values.scheduleEndDate.toString() !== formik.values.scheduleStartDate.toString() && ( diff --git a/app/src/utils/utils.ts b/app/src/utils/utils.ts index 6635f4af7b..2bddec5146 100644 --- a/app/src/utils/utils.ts +++ b/app/src/utils/utils.ts @@ -77,7 +77,7 @@ export const transformToIdValueArray = (data: {[key: string | number]: any}) => } ] */ -export const transformToObjectArray = (data: {[key: string | number]: object}) => { +export const transformToObjectArray = (data: {[key: string | number]: any}) => { return Object.keys(data).map((key) => { return { id: key,