diff --git a/src/components/events/partials/ModalTabsAndPages/EventDetailsSchedulingTab.tsx b/src/components/events/partials/ModalTabsAndPages/EventDetailsSchedulingTab.tsx index 9d777f78c3..f200512a3b 100644 --- a/src/components/events/partials/ModalTabsAndPages/EventDetailsSchedulingTab.tsx +++ b/src/components/events/partials/ModalTabsAndPages/EventDetailsSchedulingTab.tsx @@ -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"; @@ -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() && ( - - ) - } {!hasAccessRole && ( diff --git a/src/components/events/partials/ModalTabsAndPages/NewSourcePage.tsx b/src/components/events/partials/ModalTabsAndPages/NewSourcePage.tsx index 5e063b6375..a43006535d 100644 --- a/src/components/events/partials/ModalTabsAndPages/NewSourcePage.tsx +++ b/src/components/events/partials/ModalTabsAndPages/NewSourcePage.tsx @@ -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"; @@ -599,17 +598,15 @@ const Schedule = - {/* 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() && ( - - )} - { - // Get info about the current language and its date locale - const currentLanguage = getCurrentLanguageInformation(); - - return ( - - - - - {new Date( - scheduleEndDate - ).toLocaleDateString( - currentLanguage ? currentLanguage.dateLocale.code : undefined - )} - - - - ) -}; - -export default SchedulingEndDateDisplay; diff --git a/src/components/events/partials/wizards/scheduling/SchedulingTime.tsx b/src/components/events/partials/wizards/scheduling/SchedulingTime.tsx index d321a09b86..b9d6e0b742 100644 --- a/src/components/events/partials/wizards/scheduling/SchedulingTime.tsx +++ b/src/components/events/partials/wizards/scheduling/SchedulingTime.tsx @@ -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 = ({ @@ -13,7 +14,8 @@ const SchedulingTime = ({ hourPlaceholder, minutePlaceholder, callbackHour, - callbackMinute + callbackMinute, + date }: { hour: string, minute: string, @@ -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 ( @@ -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 && + + {new Date(date).toLocaleDateString( + currentLanguage ? currentLanguage.dateLocale.code : undefined + )} + + } )