Skip to content

What is the typical way to persist currency? #494

Answered by sarahdayan
johnhooks asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @johnhooks!

I understand that I can rely on the currencies not to change, unless upgrading to a breaking change version of dinero.

What the documentation means is that, if a currency changes (for example, if the U.S. dollar suddenly becomes 1000 cents in a dollar), changing it in Dinero.js is a breaking change in nature, which is why there's a different importing strategy to avoid breakages.

But what is the typical way to persist the currency of a dinero object, like in a database, so it can be retrieved later and also insured that the appropriate currency exponent and base always be used?

There's a whole guide on this topic. It's good practice to store a full snapshot of Dinero o…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@johnhooks
Comment options

@johnhooks
Comment options

@sarahdayan
Comment options

Answer selected by sarahdayan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants