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

Feature Request: Add function to preprocess amount

Open DArrigoni opened this issue 5 years ago • 5 comments

My project uses a lot of dollar amounts but they are all stored on the server as "in cents." ie. $10.00 would be stored as 1000.

Currently, I have to pass these amounts through two filters, one to convert the amount from "in cents" to "in dollars" before passing it into the currency filter. It would be nice to be able to provide the currency filter config a function to do this.

Example:

Vue.use(VueCurrencyFilter, {
  symbol: "$",
  thousandsSeparator: ",",
  fractionCount: 2,
  fractionSeparator: ".",
  symbolSpacing: false,
  convert: function (amount) { return amount / 100 }
})

If you feel this is within the scope of the vue-currency-filter, and I would understand if you don't feel it is, I would be happy to give this shot and send you a pull request.

DArrigoni avatar Aug 12 '20 23:08 DArrigoni

Can you help to check the code? Maybe you can build it for your needs. I think it's good addition.

mazipan avatar Aug 13 '20 10:08 mazipan

@mazipan Is this feature still open for a PR?

dsfx3d avatar Sep 05 '20 21:09 dsfx3d

The project has great utility for some use cases but we need to work on the code quality as well to maintain a good developer experience for all potential contributors. Should I make a PR with a linting set up first? There are lint errors in almost all modules.

dsfx3d avatar Sep 06 '20 14:09 dsfx3d

Yes sure

mazipan avatar Sep 06 '20 15:09 mazipan

Any news on this one ? 🤗

kissu avatar Feb 05 '21 02:02 kissu