Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix end time date display for scheduling #1158

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ import { Recording } from "../../../../slices/recordingSlice";
import { useTranslation } from "react-i18next";
import WizardNavigationButtons from "../../../shared/wizard/WizardNavigationButtons";
import SchedulingTime from "../wizards/scheduling/SchedulingTime";
import SchedulingEndDateDisplay from "../wizards/scheduling/SchedulingEndDateDisplay";
import SchedulingLocation from "../wizards/scheduling/SchedulingLocation";
import SchedulingInputs from "../wizards/scheduling/SchedulingInputs";
import SchedulingConflicts from "../wizards/scheduling/SchedulingConflicts";
Expand Down Expand Up @@ -415,16 +414,15 @@ const EventDetailsSchedulingTab = ({
checkConflictsWrapper
)
}}
date={
hasAccessRole &&
(new Date(formik.values.scheduleEndDate).getDate() !==
new Date(formik.values.scheduleStartDate).getDate())
? formik.values.scheduleEndDate
: undefined
}
/>
)}
{hasAccessRole &&
formik.values.scheduleEndDate.toString() !==
formik.values.scheduleStartDate.toString() && (
<SchedulingEndDateDisplay
scheduleEndDate={formik.values.scheduleEndDate}
/>
)
}
{!hasAccessRole && (
<tr>
<td>
Expand Down
17 changes: 7 additions & 10 deletions src/components/events/partials/ModalTabsAndPages/NewSourcePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import { checkConflicts, UploadAssetsTrack } from "../../../../slices/eventSlice
import ModalContentTable from "../../../shared/modals/ModalContentTable";
import ButtonLikeAnchor from "../../../shared/ButtonLikeAnchor";
import SchedulingTime from "../wizards/scheduling/SchedulingTime";
import SchedulingEndDateDisplay from "../wizards/scheduling/SchedulingEndDateDisplay";
import SchedulingLocation from "../wizards/scheduling/SchedulingLocation";
import SchedulingInputs from "../wizards/scheduling/SchedulingInputs";
import SchedulingConflicts from "../wizards/scheduling/SchedulingConflicts";
Expand Down Expand Up @@ -599,17 +598,15 @@ const Schedule = <T extends {
);
}
}}
date={
formik.values.sourceMode === "SCHEDULE_SINGLE" &&
(new Date(formik.values.scheduleEndDate).getDate() !==
new Date(formik.values.scheduleStartDate).getDate())
? formik.values.scheduleEndDate
: undefined
}
/>

{/* display end date if on different day to start date, only if this is current source mode */}
{formik.values.sourceMode === "SCHEDULE_SINGLE" &&
formik.values.scheduleEndDate.toString() !==
formik.values.scheduleStartDate.toString() && (
<SchedulingEndDateDisplay
scheduleEndDate={formik.values.scheduleEndDate}
/>
)}

<SchedulingLocation
location={formik.values.location}
inputDevices={inputDevices}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useTranslation } from "react-i18next";
import DropDown from "../../../../shared/DropDown";
import { hours, minutes } from "../../../../../configs/modalConfig";
import { formatTimeForDropdown } from "../../../../../utils/dropDownUtils";
import { getCurrentLanguageInformation } from "../../../../../utils/utils";
import { ParseKeys } from "i18next";

const SchedulingTime = ({
Expand All @@ -13,7 +14,8 @@ const SchedulingTime = ({
hourPlaceholder,
minutePlaceholder,
callbackHour,
callbackMinute
callbackMinute,
date
}: {
hour: string,
minute: string,
Expand All @@ -23,8 +25,11 @@ const SchedulingTime = ({
minutePlaceholder: ParseKeys
callbackHour: (value: string) => void
callbackMinute: (value: string) => void
date?: string | Date
}) => {
const { t } = useTranslation();
// Get info about the current language and its date locale
const currentLanguage = getCurrentLanguageInformation();

return (
<tr>
Expand Down Expand Up @@ -65,6 +70,16 @@ const SchedulingTime = ({
disabled={disabled}
customCSS={{width: 70}}
/>

{/* Displays given date. Can be used to signify which date the
scheduling time belong to*/}
{date &&
<span style={{ marginLeft: "10px" }}>
{new Date(date).toLocaleDateString(
currentLanguage ? currentLanguage.dateLocale.code : undefined
)}
</span>
}
</td>
</tr>
)
Expand Down
Loading