Use builtin number validation (#8819)
The regex approach doesn't work great for the many different number formats. Even a simple decimal failed e.g. '1.1' was considered invalid. I've switched this over to use javascripts builtin conversion and validation. This now supports other formats e.g. '-1.0e15' would now be considered valid. Closes: #8820
This commit is contained in:
@ -33,9 +33,9 @@ export const getSpreadSheetFieldValidationDefinitions = (
|
||||
case FieldMetadataType.Number:
|
||||
return [
|
||||
{
|
||||
rule: 'regex',
|
||||
value: '^\\d+$',
|
||||
errorMessage: fieldName + ' must be a number',
|
||||
rule: 'function',
|
||||
isValid: (value: string) => !isNaN(+value),
|
||||
errorMessage: fieldName + ' is not valid',
|
||||
level: 'error',
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user