Open KazTheCreator opened 3 weeks ago
Hi @KazTheCreator ,
Seems to be working fine on my side. What device are you using?
Hi! I have the same behavior. When I add decimal with '.' and the first 0 after the '.' the zero is cut of, but as it is described with ',' it works good.
I use Mac and Brave.
@KazTheCreator @vvadymk Yeah. Got it will try submit a PR to fix. Think it has to do with the 'looseNumber' function. @benjamincanac any input? Should I just add a check to only convert to number if doesn't start with 0? It seems a bit complex unless we remove this?
Thank you guys! If you need further information from me - tell me! :)
@romhml Any insight on this?
Hey! I dont really know if it helps but anyway. https://ui.nuxt.com/components/input#type
if you enter 0 then :model-value="0" as soon you enter the dot (0.) then :model-value=""
"0," is behaving fine.
I think I found the culprit:
https://github.com/nuxt/ui/blob/dev/src/runtime/components/forms/Input.vue#L194
The looseToNumber
function uses parseFloat
which replaces 1.0
or 1,0
to 1
. Here's a few tests from the node console:
> parseFloat('1,0')
1
> parseFloat('1.0')
1
> parseFloat('1.01')
1.01
We need to tweak the function to preserve the .0
as the user is typing. Might be related to https://github.com/vuejs/vue/issues/11989 and https://github.com/vuejs/vue/issues/7136 too.
Description
Hey! Im using an UInput type number and encountered something strange. It is not possible to write the number "1.04" or "0.06". The culprit seems to be the "0" after the ".". Further example of working decimal: "1.14", 1.56" It works fine if you use "," as a comma but my mobile phones number keyboard only provides ".".
The same behvaiour can be tested here: https://ui.nuxt.com/components/input
Im using Mac and Chrome to test.
Let me know what you think! :)