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) {
|
||||
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 {
|
||||
res = validateJs.single(row[fieldName], constraints)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue