set scedule date to null when schedule status changed

This commit is contained in:
Sadaqat Ali 2022-07-05 22:59:39 +05:00
parent 31ee6ef52f
commit 16f4e2c453

View File

@ -87,9 +87,12 @@ const PostOptionsModal = forwardRef(({
},[scheduledFor])
useEffect(() => {
if(scheduledForDate){
if (scheduledForDate) {
setScheduleLater(true);
setScheduledFor(scheduledForDate);
} else {
setScheduleLater(false);
setScheduledFor('');
}
},[scheduledForDate])
@ -155,8 +158,11 @@ const PostOptionsModal = forwardRef(({
intl.formatMessage({id:"editor.scheduled_later"}),
]}
selectedOptionIndex={scheduleLater ? 1 : 0}
handleOnChange={(index)=>{
setScheduleLater(index === 1)
handleOnChange={(index)=> {
setScheduleLater(index === 1);
if (index !== 1) {
handleScheduleChange(null);
}
}}
/>