Giter Club home page Giter Club logo

Comments (6)

neves avatar neves commented on August 17, 2024

I thought about this, too. Should use Math.round()?

The line needed to be changed is this one:
https://github.com/vuejs-tips/v-money/blob/master/src/utils.js#L22
and this one:
https://github.com/vuejs-tips/v-money/blob/master/src/component.vue#L70
And the input format, too.

I'm not happy with the name minorUnits, any other suggestion?

from v-money.

chris-jamieson avatar chris-jamieson commented on August 17, 2024

Thanks @neves - I will try to put a PR together for this in the next few days.

Some other suggestions for the options name if you don't like minorUnits:

  • multiplier
  • precisionMultiplier
  • cents
  • integer

I'm sure there are plenty of other possibilities!

from v-money.

neves avatar neves commented on August 17, 2024

Since the number 12,34 would be converted to 1234 which is que amount of cents in the value, I think cents would be more appropriated.

from v-money.

neves avatar neves commented on August 17, 2024

Forget about Math.round, there's no need to.
I think just converting R$ 12,34 to 1234 (using onlyNumbers https://github.com/vuejs-tips/v-money/blob/master/src/utils.js#L25) and converting back to integer with parseInt is enough.

from v-money.

boycce avatar boycce commented on August 17, 2024

Any progress been made on this?

from v-money.

chris-jamieson avatar chris-jamieson commented on August 17, 2024

For those interested, I just wanted to share I ended up using the vue-currency-input package for this purpose, which includes the option value-as-integer (see config reference).

For the sake of tidiness I will close this issue. Apologies I was not able to contribute to this great package.

from v-money.

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.