Skip to content

Commit

Permalink
feat(utils): set max decimal numbers to 2 (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
aimok04 committed Nov 9, 2024
1 parent 6f7c91e commit 9ae031f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/src/main/java/de/kitshn/android/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ fun Double.formatAmount(fractional: Boolean = true): String {
val value = if(int == 0) "" else "$int "
return "$value${formatDecimalToFraction(decimal)}"
} else {
return NumberFormat.getNumberInstance().format(this)
return NumberFormat.getNumberInstance().apply {
maximumFractionDigits = 2
}.format(this)
}
}

Expand Down

0 comments on commit 9ae031f

Please sign in to comment.