Skip to content

Commit

Permalink
fix: use standar format currency when 0
Browse files Browse the repository at this point in the history
  • Loading branch information
newarifrh committed Aug 1, 2024
1 parent 4eb8368 commit 6f10226
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/currency.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const formatCurrency = (number: number): string => {
if (!number) return "0";
if (!number) return "0,00";
const parts = number.toFixed(2).toString().split(".");
const formattedInteger = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".");
return `${formattedInteger},${parts[1]}`;
Expand Down

0 comments on commit 6f10226

Please sign in to comment.