Skip to content

Commit

Permalink
feat: scheduleDate reset when there is invalid date
Browse files Browse the repository at this point in the history
  • Loading branch information
alaa-yahia committed Nov 4, 2024
1 parent 0307326 commit ab8297b
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import withStyles from '@material-ui/core/styles/withStyles';
import { DateField } from 'capture-core/components/FormFields/New';
import { InfoBox } from '../InfoBox';
import type { Props } from './scheduleDate.types';
import { convertStringToDateFormat } from '../../../utils/converters/date';


const styles = {
container: {
Expand Down Expand Up @@ -36,7 +34,14 @@ const ScheduleDatePlain = ({
onSetFocus={() => {}}
onFocus={() => { }}
onRemoveFocus={() => { }}
onBlur={(e) => { setScheduleDate(convertStringToDateFormat(e)); }}
onBlur={(e, internalComponentError) => {
const { error } = internalComponentError;
if (error) {
setScheduleDate('');
return;
}
setScheduleDate(e);
}}
/>
</div>}
<InfoBox
Expand Down

0 comments on commit ab8297b

Please sign in to comment.