Skip to content

Commit

Permalink
fix: datePicker setFieldTouched true on change (#572)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Lebinson <[email protected]>
  • Loading branch information
Dorin-RFL and alebinson authored Dec 24, 2024
1 parent 82052b1 commit 2be8e7c
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ export const DateValuePresentorComponent: React.FC<DateValuePresentorProps> = ({
onChange={
(dateVal, val): void => {
const momentVal = moment(dateVal, getDateformatType(shouldShowTime));
const maxNowValidation = (fieldInfo.validation?.find((valid)=> valid.max === '$NOW'))? new Date(): null;
formik?.setFieldTouched(fieldName, true);
if(maxNowValidation){
if (dateVal > maxNowValidation){
formik?.setFieldError(fieldName, '');
};
}
handleOnChange({
/* eslint-disable */
persist: () => {},
Expand Down

0 comments on commit 2be8e7c

Please sign in to comment.