Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

q-numeric with 0.1 step lacks rounding #261

Closed
caex opened this issue Dec 16, 2016 · 5 comments
Closed

q-numeric with 0.1 step lacks rounding #261

caex opened this issue Dec 16, 2016 · 5 comments

Comments

@caex
Copy link

caex commented Dec 16, 2016

Hi,

<q-numeric :min="9" :max="199" :step="0.1" v-model="foo"></q-numeric>

foo === 22.1

Click the + button

What is expected ?

foo === 22.2

What is actually happening ?

foo === 22.200000000000003

Cheers

@rstoenescu
Copy link
Member

Will fix it. Thanks for reporting!

@vuchl
Copy link

vuchl commented Dec 16, 2016

Yes the step attribute is not paassed down to the input
https://github.com/quasarframework/quasar/blob/dev/src/vue-components/numeric/Numeric.vue#L4-L16

@rstoenescu
Copy link
Member

@vuchl it doesn't have to be passed to the input. Look down the file.

Who cares for an easy PR on this?

@vuchl
Copy link

vuchl commented Dec 16, 2016

@rstoenescu hmm. for me the code looks good. can't spot it. but if you allready identified the cause, why not commit the fix yourself?

@rstoenescu
Copy link
Member

You can't even imagine how many things I am handling. Eventually I'll make a fix myself for this if no one takes it, but it would speed up things if easier tickets are taken from my queue.

For this ticket there's the Javascript floating point issue occuring (Google it). The fix would be something like parseFloat(number).toPrecision(X) when updating the model (where X is the precision of the step).

@rstoenescu rstoenescu added this to the v0.11 milestone Dec 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants