Comments (8)
Support for custom decimal length is now available in release 1.8.0:
https://dm4t2.github.io/vue-currency-input/examples/#decimal-length
from vue-currency-input.
Hi, the number of decimal digits is defined by the used currency and currently not customizable. But I plan to make the configuration more flexible, because sometimes there are situations where you want to deviate from it.
from vue-currency-input.
You probably want to use valueAsInteger
?
https://dm4t2.github.io/vue-currency-input/examples/#value-as-integer
from vue-currency-input.
I am also interested in this, specially when working with exchange rates and currency conversions.
There are two cases:
-
Show the full decimal digits.
For example 1 USD = 0.891735 EUR, so in theory the EURO currency has only 2 decimal digits (or sub-units) but in reality for precise calculations all decimals digits need to be stored. -
Show rounded number (defined by currency), store the original value with all decimal digits internally.
For example in a shopping app, a customer in an airport buys a coffee for 10 USD but wants to pay in EURO, so he needs to pay 8.91933 EURO. The number shown in the input is rounded to 8.92 EUR. But internally it's important to store all the decimal digits as it is a currency conversion.
from vue-currency-input.
For example with my COP currency not need display decimals. It would enough show just 1,000 COP and not 1,000.00 COP.
Thanks it's an amazing tool.
Regards,
from vue-currency-input.
@jonagoldman
The use cases you described don't work since the stored number is parsed based on the current input value and therefore always has the number of visible decimal digits.
from vue-currency-input.
I don't know if this apply in my case but I'm using a payment gateway that requires the currency to be formatted as 90000
meaning 900.00
but when I put 90000
as the value for the input it shows me 90.000,00
from vue-currency-input.
@dm4t2 Oh gosh, I didn't notice that it would return exactly the way I need.
The only problem tho is when I need to edit this value and put on the input right? Because on the database will be 90000
and the input will show 90.000,00
I need to be able to read the value from the database to the input as well.
I solved it by diving the valeu by 100
. (90000/100
= 900
)
from vue-currency-input.
Related Issues (20)
- Input not getting updated when used with v-model and pinia store HOT 1
- IOS keyboard no minus option HOT 3
- copy paste value with dot don't insert HOT 1
- vue-currency-input shows 0 value in the first row on project edit page in my Vue 3 TypeScript project HOT 1
- Starting zeros are removed to fast HOT 1
- Quasar with vue-currency-input HOT 1
- Incompatible with Nuxt 2 / Vue 2.7.14 HOT 1
- CAD is a valid A ISO 4217 currency code but it doesnt work HOT 3
- Different Results with Locale on Different Browsers HOT 1
- Unexpected autoDecimalDigits behavior in component Playground HOT 1
- Allow custom lookup strategy for input element
- wrong result (using decimal > 10) HOT 1
- Component emitted event "change" but it is neither declared in the emits option nor as an "onChange" prop. HOT 4
- Inconsistent behaviour with Firefox + Vuetify 2 HOT 2
- No emits on vue 2.7.10 & nuxt HOT 5
- Adding options watcher in Quasar example causes input to malfunction HOT 2
- When setting currency input options, getting an error saying argument type is not assignable to CurrencyInputOptions HOT 1
- Problem with attribute currencyDisplay when use Typescript HOT 3
- TypeError: undefined is not an object (evaluating 'this.numberMask.conformToMask') in IOS 12 HOT 1
- Input breaks when using watch options and autoDecimalDigits false HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-currency-input.