@@ -12,7 +12,7 @@ import { Field } from "../../../shared/Field";
1212import RenderField from "../../../shared/wizard/RenderField" ;
1313import { getRecordings } from "../../../../selectors/recordingSelectors" ;
1414import { sourceMetadata } from "../../../../configs/sourceConfig" ;
15- import { weekdays } from "../../../../configs/modalConfig" ;
15+ import { weekdays , NOTIFICATION_CONTEXT } from "../../../../configs/modalConfig" ;
1616import { getUserInformation } from "../../../../selectors/userInfoSelectors" ;
1717import {
1818 filterDevicesForAccess ,
@@ -37,7 +37,7 @@ import {
3737} from "../../../../utils/dateUtils" ;
3838import { useAppDispatch , useAppSelector } from "../../../../store" ;
3939import { Recording , fetchRecordings } from "../../../../slices/recordingSlice" ;
40- import { removeNotificationWizardForm } from "../../../../slices/notificationSlice" ;
40+ import { addNotification , removeNotificationWizardForm } from "../../../../slices/notificationSlice" ;
4141import { parseISO } from "date-fns" ;
4242import WizardNavigationButtons from "../../../shared/wizard/WizardNavigationButtons" ;
4343import { checkConflicts , UploadAssetsTrack } from "../../../../slices/eventSlice" ;
@@ -370,6 +370,23 @@ const Schedule = <T extends {
370370} ) => {
371371 const { t } = useTranslation ( ) ;
372372 const currentLanguage = getCurrentLanguageInformation ( ) ;
373+ const dispatch = useAppDispatch ( ) ;
374+
375+ // Parse start-Date strings
376+ const startDateTime = new Date (
377+ `${ new Date ( formik . values . scheduleStartDate ) . toISOString ( ) . split ( "T" ) [ 0 ] } T${ formik . values . scheduleStartHour } :${ formik . values . scheduleStartMinute } :00` ,
378+ ) ;
379+
380+ // Parse end datetime
381+ const endDateTime = new Date (
382+ `${ new Date ( formik . values . scheduleEndDate ) . toISOString ( ) . split ( "T" ) [ 0 ] } T${ formik . values . scheduleEndHour } :${ formik . values . scheduleEndMinute } :00` ,
383+ ) ;
384+
385+ const now = new Date ( ) ;
386+
387+ // Event is in progress
388+ const eventInProgress = now >= startDateTime && now <= endDateTime ;
389+
373390 const getEndDateForSchedulingTime = ( ) => {
374391 const {
375392 scheduleStartDate,
@@ -631,6 +648,17 @@ const Schedule = <T extends {
631648 hourPlaceholder = { "EVENTS.EVENTS.DETAILS.SOURCE.PLACEHOLDER.HOUR" }
632649 minutePlaceholder = { "EVENTS.EVENTS.DETAILS.SOURCE.PLACEHOLDER.MINUTE" }
633650 callbackHour = { ( value : string ) => {
651+ if ( eventInProgress && value < formik . values . scheduleEndHour ) {
652+ dispatch (
653+ addNotification ( {
654+ type : "error" ,
655+ key : "CONFLICT_END_TIME_TOO_EARLY" ,
656+ duration : - 1 ,
657+ context : NOTIFICATION_CONTEXT ,
658+ } ) ,
659+ ) ;
660+ return ; // Block shortening
661+ }
634662 if ( formik . values . sourceMode === "SCHEDULE_MULTIPLE" ) {
635663 changeEndHourMultiple (
636664 value ,
@@ -646,6 +674,19 @@ const Schedule = <T extends {
646674 }
647675 } }
648676 callbackMinute = { ( value : string ) => {
677+
678+ if ( eventInProgress && value < formik . values . scheduleEndMinute ) {
679+ dispatch (
680+ addNotification ( {
681+ type : "error" ,
682+ key : "CONFLICT_END_TIME_TOO_EARLY" ,
683+ duration : - 1 ,
684+ context : NOTIFICATION_CONTEXT ,
685+ } ) ,
686+ ) ;
687+ return ; // Block shortening
688+ }
689+
649690 if ( formik . values . sourceMode === "SCHEDULE_MULTIPLE" ) {
650691 changeEndMinuteMultiple (
651692 value ,
0 commit comments