@@ -119,6 +119,12 @@ const EventModal: React.FC<EventModalProps> = ({
119119 return ;
120120 }
121121
122+ // 반복일정 선택 시 종료일 필수 검증
123+ if ( formData . repeat && formData . repeat !== 'none' && ! formData . repeatEndDate ) {
124+ toast . error ( '반복일정을 선택했을 때는 반복 종료 날짜를 꼭 선택해야 합니다.' ) ;
125+ return ;
126+ }
127+
122128 // 반복 종료 날짜가 시작 날짜보다 이전인지 검증
123129 if ( formData . repeatEndDate && formData . date && formData . repeatEndDate < formData . date ) {
124130 toast . error ( '반복 종료 날짜는 시작 날짜보다 이후여야 합니다.' ) ;
@@ -407,7 +413,22 @@ const EventModal: React.FC<EventModalProps> = ({
407413 </ label >
408414 < select
409415 value = { formData . repeat }
410- onChange = { ( e ) => setFormData ( prev => ( { ...prev , repeat : e . target . value as Event [ 'repeat' ] } ) ) }
416+ onChange = { ( e ) => {
417+ const repeatValue = e . target . value as Event [ 'repeat' ] ;
418+ setFormData ( prev => ( {
419+ ...prev ,
420+ repeat : repeatValue ,
421+ // 반복을 'none'으로 변경하면 종료일 초기화
422+ repeatEndDate : repeatValue === 'none' ? undefined : prev . repeatEndDate
423+ } ) ) ;
424+
425+ // 반복일정을 선택한 경우 안내 메시지
426+ if ( repeatValue !== 'none' ) {
427+ setTimeout ( ( ) => {
428+ toast . success ( '반복일정을 선택했습니다. 반복 종료 날짜를 꼭 설정해주세요.' ) ;
429+ } , 100 ) ;
430+ }
431+ } }
411432 className = "w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:outline-none focus:ring-accent-500 focus:border-transparent"
412433 disabled = { isSubmitting }
413434 >
@@ -423,7 +444,7 @@ const EventModal: React.FC<EventModalProps> = ({
423444 { formData . repeat && formData . repeat !== 'none' && (
424445 < div >
425446 < label className = "block text-sm font-medium text-gray-700 mb-2" >
426- 반복 종료 날짜 (선택사항)
447+ 반복 종료 날짜 * < span className = "text-xs text-red-500" > (필수) </ span >
427448 </ label >
428449 < input
429450 type = "date"
@@ -432,9 +453,13 @@ const EventModal: React.FC<EventModalProps> = ({
432453 ...prev ,
433454 repeatEndDate : e . target . value ? new Date ( e . target . value ) : undefined
434455 } ) ) }
435- className = "w-full px-3 py-2 border border-gray -300 rounded-lg focus:ring-2 focus:outline-none focus:ring-accent -500 focus:border-transparent "
456+ className = "w-full px-3 py-2 border-2 border-red -300 rounded-lg focus:ring-2 focus:outline-none focus:ring-red -500 focus:border-red-500 bg-red-50 "
436457 disabled = { isSubmitting }
458+ required
437459 />
460+ < p className = "text-xs text-gray-500 mt-1" >
461+ 반복일정을 선택했을 때는 반드시 종료 날짜를 설정해야 합니다.
462+ </ p >
438463 </ div >
439464 ) }
440465
0 commit comments