Skip to content

Commit bb1cd83

Browse files
committed
Fix end time date display for scheduling
Fixes display behaviour for the end time date display on the scheduling pages to go back to how it was before. Namely the end time date is now again displayed in the same row as the end time, and is only actually displayed if the end time is "before" the start time (at which the ui assumes that the end time has to be on the next day).
1 parent 57e21b1 commit bb1cd83

File tree

4 files changed

+30
-48
lines changed

4 files changed

+30
-48
lines changed

src/components/events/partials/ModalTabsAndPages/EventDetailsSchedulingTab.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ import { Recording } from "../../../../slices/recordingSlice";
4747
import { useTranslation } from "react-i18next";
4848
import WizardNavigationButtons from "../../../shared/wizard/WizardNavigationButtons";
4949
import SchedulingTime from "../wizards/scheduling/SchedulingTime";
50-
import SchedulingEndDateDisplay from "../wizards/scheduling/SchedulingEndDateDisplay";
5150
import SchedulingLocation from "../wizards/scheduling/SchedulingLocation";
5251
import SchedulingInputs from "../wizards/scheduling/SchedulingInputs";
5352
import SchedulingConflicts from "../wizards/scheduling/SchedulingConflicts";
@@ -410,16 +409,15 @@ const EventDetailsSchedulingTab = ({
410409
checkConflictsWrapper
411410
)
412411
}}
412+
date={
413+
hasAccessRole &&
414+
(new Date(formik.values.scheduleEndDate).getDate() !==
415+
new Date(formik.values.scheduleStartDate).getDate())
416+
? formik.values.scheduleEndDate
417+
: undefined
418+
}
413419
/>
414420
)}
415-
{hasAccessRole &&
416-
formik.values.scheduleEndDate.toString() !==
417-
formik.values.scheduleStartDate.toString() && (
418-
<SchedulingEndDateDisplay
419-
scheduleEndDate={formik.values.scheduleEndDate}
420-
/>
421-
)
422-
}
423421
{!hasAccessRole && (
424422
<tr>
425423
<td>

src/components/events/partials/ModalTabsAndPages/NewSourcePage.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ import { parseISO } from "date-fns";
4242
import WizardNavigationButtons from "../../../shared/wizard/WizardNavigationButtons";
4343
import { checkConflicts, UploadAssetsTrack } from "../../../../slices/eventSlice";
4444
import SchedulingTime from "../wizards/scheduling/SchedulingTime";
45-
import SchedulingEndDateDisplay from "../wizards/scheduling/SchedulingEndDateDisplay";
4645
import SchedulingLocation from "../wizards/scheduling/SchedulingLocation";
4746
import SchedulingInputs from "../wizards/scheduling/SchedulingInputs";
4847
import SchedulingConflicts from "../wizards/scheduling/SchedulingConflicts";
@@ -601,17 +600,15 @@ const Schedule = <T extends {
601600
);
602601
}
603602
}}
603+
date={
604+
formik.values.sourceMode === "SCHEDULE_SINGLE" &&
605+
(new Date(formik.values.scheduleEndDate).getDate() !==
606+
new Date(formik.values.scheduleStartDate).getDate())
607+
? formik.values.scheduleEndDate
608+
: undefined
609+
}
604610
/>
605611

606-
{/* display end date if on different day to start date, only if this is current source mode */}
607-
{formik.values.sourceMode === "SCHEDULE_SINGLE" &&
608-
formik.values.scheduleEndDate.toString() !==
609-
formik.values.scheduleStartDate.toString() && (
610-
<SchedulingEndDateDisplay
611-
scheduleEndDate={formik.values.scheduleEndDate}
612-
/>
613-
)}
614-
615612
<SchedulingLocation
616613
location={formik.values.location}
617614
inputDevices={inputDevices}

src/components/events/partials/wizards/scheduling/SchedulingEndDateDisplay.tsx

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/components/events/partials/wizards/scheduling/SchedulingTime.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useTranslation } from "react-i18next";
33
import DropDown from "../../../../shared/DropDown";
44
import { hours, minutes } from "../../../../../configs/modalConfig";
55
import { formatTimeForDropdown } from "../../../../../utils/dropDownUtils";
6+
import { getCurrentLanguageInformation } from "../../../../../utils/utils";
67

78
const SchedulingTime = ({
89
hour,
@@ -12,7 +13,8 @@ const SchedulingTime = ({
1213
hourPlaceholder,
1314
minutePlaceholder,
1415
callbackHour,
15-
callbackMinute
16+
callbackMinute,
17+
date
1618
}: {
1719
hour: string,
1820
minute: string,
@@ -22,8 +24,11 @@ const SchedulingTime = ({
2224
minutePlaceholder: string
2325
callbackHour: (value: string) => void
2426
callbackMinute: (value: string) => void
27+
date?: string | Date
2528
}) => {
2629
const { t } = useTranslation();
30+
// Get info about the current language and its date locale
31+
const currentLanguage = getCurrentLanguageInformation();
2732

2833
return (
2934
<tr>
@@ -64,6 +69,16 @@ const SchedulingTime = ({
6469
disabled={disabled}
6570
customCSS={{width: 70}}
6671
/>
72+
73+
{/* Displays given date. Can be used to signify which date the
74+
scheduling time belong to*/}
75+
{date &&
76+
<span style={{ marginLeft: "10px" }}>
77+
{new Date(date).toLocaleDateString(
78+
currentLanguage ? currentLanguage.dateLocale.code : undefined
79+
)}
80+
</span>
81+
}
6782
</td>
6883
</tr>
6984
)

0 commit comments

Comments
 (0)