Decimal Number fields don't allow ".00" anymore

Hello!
Another problem i found when upgrading from kirby v2 to kirby v3… It was possible to save prices by a number field with step: .01, such as 15.00 (€). In Kirby v3, the “.00” gets removed now. Of course, I could add the zeros programmatically, but it would be way cleaner to just let me prevent this behaviour. Any ideas?

1 Like

Sounds like a bug.

there seem to be some tests in place but not for keeping zeros after the decimal dot (.00).

the number field calls toNumber

which calls Str::float()

maybe vues js Number type strips the trailing zeros?

@bnomei Yep, too bad tests only test what you want them to test. They could really be more intelligent :wink:

This should be fixed in 3.3.0.

1 Like

Nope, sorry but i can still reproduce this bug with 3.3.0. It does not save neither 15,00 or 15.00, but always cuts it to 15

Looking at the merged pull request it seems like they fixed something in the .vue, when leaving directly the field, but it’s not about the frontend, it’s about what’s saved in the .txt file…

With the step option set? For me it works with the step option set, but I think there should be an error indicator if you enter a decimal where it is not intended.

Maybe we are talking about two different things here or I got something wrong - I’ve made a video to show you what behaviour i experience which I want to avoid: https://youtu.be/GgKWI1qDvPY

Ah, thank you, I somehow missed what you meant.

But see this issue comment:

It should not matter how it is stored in the content file though. If the frontend needs it displayed with a certain number of decimals, then this should be ensured by frontend code. ([Panel] Number field removes decimal values when they are 0. · Issue #1748 · getkirby/kirby · GitHub)

As far as I can see, all fixes were just related to the Vue component.