InputNumber - MinFractionDigits and MaxFractionDigits no longer respect a value of 0 #15772
Labels
LTS-PORTABLE
Issue's fix will be ported to supported LTS versions
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
Describe the bug
When setting the min and max fraction digits to 0 to show the number as an integer, the control will display the number with 2 digits.
This is broken after this PR merged in 17.18.0
https://github.com/primefaces/primeng/pull/15660/files
The issue seems to be 0 being a falsey value, so the min and max resolve to undefined, so it falls back to
Intl.NumberFormat
options.Proposed Resolution (lines 561-562):
minimumFractionDigits: this.minFractionDigits ?? undefined,
maximumFractionDigits: this.maxFractionDigits ?? undefined
Environment
Normal.
Reproducer
https://stackblitz.com/run?file=src%2Fapp%2Finput-number-numerals-demo.ts,src%2Fapp%2Finput-number-numerals-demo.html
Angular version
17
PrimeNG version
17.18.0
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
18 LTS
Browser(s)
No response
Steps to reproduce the behavior
Set your min and max fraction digits to 0. See the value not being respected. This is visible in the stackblitz on https://primeng.org/inputnumber
Expected behavior
The number is displayed as a whole number. All number formats are broken (integer, currency, and decimal)
The text was updated successfully, but these errors were encountered: