Altinn / Altinn/app-frontend-react

fixedDecimalScale adding zeros to numbers in Input field

Open
#3,823 3 comments 0 reactions 0 assignees View on GitHub
org/ssb squad/utforming status/for-consideration status/triage
Dominant language
TypeScript
Stars
21
Forks
33
Avg merge
6d 23h
Merged PRs (30d)
3

Description

### Description of the bug

When having an Input-field using fixedDecimalScale in combination with a prefix it adds zeroes on the wrong side of the decimal-separator, making the number larger than it is supposed to be!

![Image](https://github.com/user-attachments/assets/96f2ce45-b23f-4e72-a257-53fd23314503)

"formatting": {
"number":
{
"decimalScale": 2,
"fixedDecimalScale": true,
"suffix": " kr"
}}

### Steps To Reproduce

1. Create an Input-field for a decimal datafield using formatting decimalScale larger than zero, fixedDecimalScale and a prefix
2. Run and watch as you type...

### Additional Information

_No response_

Contributor guide

Open the contributing guide

Research direction

No file or test is named in the issue. Reproduce the problem with an Input field using decimalScale 2, fixedDecimalScale, and a prefix, then trace the Input-field formatting path. Done means typing the decimal value with the prefix no longer adds zeros on the wrong side of the decimal separator.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.