vue-currency-input icon indicating copy to clipboard operation
vue-currency-input copied to clipboard

Unexpected autoDecimalDigits behavior in component Playground

Open nsmith0011 opened this issue 1 year ago • 1 comments

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:

  1. Go to Playground: https://dm4t2.github.io/vue-currency-input/playground.html
  2. Turn on Auto Decimal Digits
  3. Enter ".99" into the input field. Expected to see ".99" or "0.99" in field, instead see "99.00".

Compare to CodeSandbox:

  1. Go to Examples: https://dm4t2.github.io/vue-currency-input/examples.html
  2. Click on Element Plus button which will take you to CodeSandbox
  3. Click on App.vue if not already selected
  4. Change line 9 from <ElCurrencyInput v-model="value" :options="{ currency: 'EUR' }" /> to <ElCurrencyInput v-model="value" :options="{ currency: 'EUR', autoDecimalDigits: true }" />
  5. Save
  6. Refresh browser previewer
  7. 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.

nsmith0011 avatar May 19 '23 18:05 nsmith0011

Good catch 👍 The input of the decimal separator (".") should be ignored in this case.

dm4t2 avatar May 20 '23 21:05 dm4t2