kirbydesign / designsystem

Kirby Design System
https://cookbook.kirby.design
MIT License
85 stars 23 forks source link

[BUG] Group Separator not working correctly with kirby-input setMaxOnOverflow in danish locale #3611

Open ckibsen opened 1 month ago

ckibsen commented 1 month ago

Describe the bug

Using kirby-input with kirby-decimal-mask and setMaxOnOverflow = true, fails to correcly format numbers when running in danish locale.

Describe how to reproduce the bug

Setting value = 120000.25 and max = 160001.25 in kirby-input field.

When using english locale, typing a new value of eg. 161000 results in the value being replaced by the max value 160,001.25 (nicely formatted).

When using danish locale, typing a new value of 161000 doesn't trigger a change. The same is the case if ,00 is typed as decimals - no effect. Typing a way to large number like eg 161000000 results in the input being replaced with 16.000.125 (formattet, but way larger than the max allowed value).

Which Kirby version was used?

9.6.0

What was the expected behavior?

When running in danish locale, I expect 161000 to be replaced by the formatted max value 160.000,25.

Add any screenshots

Added two screen recordings in danish and english, to show the different behaviours.

Please complete the following information:

Are there any additional context?

Rasmus Kjeldgaard has acknowledged there is a bug when using the group-separator in conjunction with kirby-input / kirby-decimal-mask, and danish locale.


Checklist:

The following tasks should be carried out in sequence in order to follow the process of contributing correctly.

Verification

To make sure the bug is not intended behaviour; it should be verified by a member of team Kirby before moving on to implementation.

Implementation

The contributor who wants to implement this issue should:

Review

Once the issue has been implemented and is ready for review:

https://github.com/user-attachments/assets/8a08c1e4-0231-427f-8885-4366ec7c3f1a

https://github.com/user-attachments/assets/f3f9d5da-10e9-4c42-8c8b-b1689ec1acc3

ckibsen commented 1 month ago

https://github.com/user-attachments/assets/e78d68f8-6a58-47fa-bc3b-c970efae26a9

https://github.com/user-attachments/assets/3e5cfad9-d67f-4c08-a299-b624a9ccb44f