Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fractionless): honor decimals in fractionless amounts #265

Merged
merged 4 commits into from
Nov 21, 2024

Conversation

alexpresthus
Copy link
Contributor

Honor the configured precision, as defined by options.decimals or
currency if options.decimals = undefined, when instatiating with
.fromFractionlessAmount() and converting .toFractionlessAmount().

Fixes old behavior:

Money.fromFractionlessAmount(1000, 'NOK', { decimals: 3 }) => 10.000 NOK
money.toFractionlessAmount() => 1000 NOK

To expected behavior:

Money.fromFractionlessAmount(1000, 'NOK', { decimals: 3 }) => 1.000 NOK
money.toFractionlessAmount() => 1000 NOK

alexpresthus and others added 2 commits November 21, 2024 10:27
Honor the configured precision, as defined by `options.decimals` or
`currency` if `options.decimals = undefined`, when instatiating with
`.fromFractionlessAmount()` and converting `.toFractionlessAmount()`.

Fixes old behavior:
```
Money.fromFractionlessAmount(1000, 'NOK', { decimals: 3 }) => 10.000 NOK
money.toFractionlessAmount() => 1000 NOK
```
To expected behavior:
```
Money.fromFractionlessAmount(1000, 'NOK', { decimals: 3 }) => 1.000 NOK
money.toFractionlessAmount() => 1000 NOK
```
fix(fractionless): Honor decimals in fractionless amounts
@alexpresthus alexpresthus changed the title fix(fractionless): Honor decimals in fractionless amounts fix(fractionless): honor decimals in fractionless amounts Nov 21, 2024
@frodeaa frodeaa merged commit b54eeb1 into Dintero:master Nov 21, 2024
1 check passed
Copy link

🎉 This PR is included in version 1.0.19 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants