We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The line value = value.replace(/^0+/, '') at https://github.com/insin/newforms/blob/react/lib/fields.js#L440 within DecimalField.prototype.clean turns the string "0" into "", which is later returned for storage in cleaned_data.
value = value.replace(/^0+/, '')
DecimalField.prototype.clean
It is also fed into this.runValidators(parseFloat(value)) at https://github.com/insin/newforms/blob/react/lib/fields.js#L482, and I haven't checked whether it will validate if max and min values have been set.
this.runValidators(parseFloat(value))
A simple but slightly hacky solution would be:
if (value !== '0') { value = value.replace(/^0+/, '') }
The text was updated successfully, but these errors were encountered:
924c300
Thanks for the bug report, a proper native decimal type can't come too soon 😁
Sorry, something went wrong.
No branches or pull requests
The line
value = value.replace(/^0+/, '')
at https://github.com/insin/newforms/blob/react/lib/fields.js#L440 withinDecimalField.prototype.clean
turns the string "0" into "", which is later returned for storage in cleaned_data.It is also fed into
this.runValidators(parseFloat(value))
at https://github.com/insin/newforms/blob/react/lib/fields.js#L482, and I haven't checked whether it will validate if max and min values have been set.A simple but slightly hacky solution would be:
The text was updated successfully, but these errors were encountered: