mirror of
https://github.com/strapi/strapi.git
synced 2025-08-09 01:07:27 +00:00
Fix date and datetime required validations issue
Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
parent
e81c6ba567
commit
b84e33ca47
@ -9,6 +9,7 @@ import {
|
|||||||
isNaN,
|
isNaN,
|
||||||
toNumber,
|
toNumber,
|
||||||
} from 'lodash';
|
} from 'lodash';
|
||||||
|
import moment from 'moment';
|
||||||
import * as yup from 'yup';
|
import * as yup from 'yup';
|
||||||
import { translatedErrors as errorsTrads } from 'strapi-helper-plugin';
|
import { translatedErrors as errorsTrads } from 'strapi-helper-plugin';
|
||||||
|
|
||||||
@ -285,6 +286,10 @@ const createYupSchemaAttribute = (type, validations, isCreatingEntry) => {
|
|||||||
return !!value;
|
return !!value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (['date', 'datetime'].includes(type)) {
|
||||||
|
return moment(value)._isValid === true;
|
||||||
|
}
|
||||||
|
|
||||||
return !isEmpty(value);
|
return !isEmpty(value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user