1
0
Fork 0
mirror of synced 2024-07-03 05:20:32 +12:00

Fix min and max value validation for date fields

This commit is contained in:
Andrew Kingston 2021-08-11 15:56:21 +01:00
parent b9887a657c
commit e3545bd02e

View file

@ -225,13 +225,15 @@ const maxLengthHandler = (value, rule) => {
// Evaluates a min value constraint
const minValueHandler = (value, rule) => {
const limit = parseType(rule.value, "number")
// Use same type as the value so that things can be compared
const limit = parseType(rule.value, rule.type)
return value && value >= limit
}
// Evaluates a max value constraint
const maxValueHandler = (value, rule) => {
const limit = parseType(rule.value, "number")
// Use same type as the value so that things can be compared
const limit = parseType(rule.value, rule.type)
return value == null || value <= limit
}