Giter VIP home page Giter VIP logo

Comments (8)

dm4t2 avatar dm4t2 commented on September 10, 2024 4

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.

dm4t2 avatar dm4t2 commented on September 10, 2024 1

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.

dm4t2 avatar dm4t2 commented on September 10, 2024 1

You probably want to use valueAsInteger?
https://dm4t2.github.io/vue-currency-input/examples/#value-as-integer

from vue-currency-input.

jonagoldman avatar jonagoldman commented on September 10, 2024

I am also interested in this, specially when working with exchange rates and currency conversions.

There are two cases:

  1. 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.

  2. 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.

jujogi avatar jujogi commented on September 10, 2024

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.

dm4t2 avatar dm4t2 commented on September 10, 2024

@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.

theprobugmaker avatar theprobugmaker commented on September 10, 2024

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.

theprobugmaker avatar theprobugmaker commented on September 10, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.