formio / formio.js

JavaScript powered Forms with JSON Form Builder

Home Page:https://formio.github.io/formio.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Number component not working for long values

gyanendrasinghpanwar opened this issue · comments

I presume this due to below function in Number.js where we have used parseInt.

parseNumber(value) {
// Remove delimiters and convert decimal separator to dot.
value = value.split(this.delimiter).join('').replace(this.decimalSeparator, '.');

if (this.component.validate && this.component.validate.integer) {
  return parseInt(value, 10);
}
else {
  return parseFloat(value);
}

}

I believe this has more to do with JavaScript limitations rather than this library limitations. Do you have an example number that causes failures?

I believe this has more to do with JavaScript limitations rather than this library limitations. Do you have an example number that causes failures?

"Indeed, this is more with JavaScript limitation. Currently, the number component is working accurately with up to 15 digits; after that, there is data loss due to parseFloat."

Do we have any plans to provide BigInt support in the number component or to offer number validation in the textfield component so that it can be used from there?

Let me know if need any Pull request.