vue-currency-input
vue-currency-input copied to clipboard
Unexpected autoDecimalDigits behavior in component Playground
Vue Currency Input version
v3.04
Vue version
v3
What browser are you using?
Firefox version 113
What operating system are you using?
Windows 10
Reproduction link
https://dm4t2.github.io/vue-currency-input/playground.html
Describe your issue
NOTE: I work in software development but I'm not a developer. This is the first "bug" (if that's what it is) I've reported on GitHub, so I hope I'm not breaking any etiquette or rules that I'm not aware of. Please be kind to me.
I did search the known issues first but didn't find this "bug" reported anywhere.
From a user POV it is expected that entering "99", ".99" or "0.99" would all result in "0.99" with the auto decimal digits function turned on. Entering "99", ".99" or "0.99" and seeing "99.00" would be unexpected by most users in my experience and seems like an anomaly/bug.
I'm seeing this unexpected behavior on the Playground but not in CodeSandbox.
To reproduce:
- Go to Playground: https://dm4t2.github.io/vue-currency-input/playground.html
- Turn on Auto Decimal Digits
- Enter ".99" into the input field. Expected to see ".99" or "0.99" in field, instead see "99.00".
Compare to CodeSandbox:
- Go to Examples: https://dm4t2.github.io/vue-currency-input/examples.html
- Click on Element Plus button which will take you to CodeSandbox
- Click on App.vue if not already selected
- Change line 9 from
<ElCurrencyInput v-model="value" :options="{ currency: 'EUR' }" />
to<ElCurrencyInput v-model="value" :options="{ currency: 'EUR', autoDecimalDigits: true }" />
- Save
- Refresh browser previewer
- Enter ".99" into the input field. See "0.99" in field, as one would expect.
Regardless of whether the behavior is intended or not, it is inconsistent between the Playground and CodeSandbox. This may be explainable but I was unable to figure out the cause given my limited developer knowledge.
Good catch 👍 The input of the decimal separator (".") should be ignored in this case.