forked from mokuappio/serverless-invoices
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from nikhilkuyya/main
release: bugfix of rounded off
- Loading branch information
Showing
8 changed files
with
10,356 additions
and
7,251 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,4 +68,4 @@ export default { | |
.heading { | ||
font-size: 1.1rem; | ||
} | ||
</style> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import Dinero from "dinero.js"; | ||
import Dinero from 'dinero.js'; | ||
|
||
export function formatCurrencyWithDinero(value, factor = 10 ** 2) { | ||
const newValue = Number(value); | ||
|
||
if (Number.isNaN(newValue)) { | ||
return ""; | ||
return ''; | ||
} | ||
|
||
|
||
const amount = Number.parseFloat((Number.parseFloat(newValue).toFixed(2) * factor).toFixed(2)); | ||
const dineroObject = Dinero({ amount: amount, currency: "INR" }); | ||
const dineroObject = Dinero({ amount: amount, currency: 'INR' }); | ||
const dineroAmount = dineroObject.toRoundedUnit(2); | ||
return Intl.NumberFormat("en-IN", { currency: "INR", style: "currency" }).format(dineroAmount); | ||
return Intl.NumberFormat('en-IN', { currency: 'INR', style: 'currency' }).format(dineroAmount); | ||
} |