Validate time only fields
This commit is contained in:
parent
4a9c1ada0f
commit
f6146c4974
1 changed files with 4 additions and 0 deletions
|
@ -205,6 +205,10 @@ export async function validate({
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
errors[fieldName] = [`Contains invalid JSON`]
|
errors[fieldName] = [`Contains invalid JSON`]
|
||||||
}
|
}
|
||||||
|
} else if (type === FieldType.DATETIME && column.timeOnly) {
|
||||||
|
if (row[fieldName] && !row[fieldName].match(/^(\d+)(:[0-5]\d){1,2}$/)) {
|
||||||
|
errors[fieldName] = [`${fieldName} is not a valid time`]
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
res = validateJs.single(row[fieldName], constraints)
|
res = validateJs.single(row[fieldName], constraints)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue