Better money formating
This commit is contained in:
+4
-2
@@ -70,8 +70,10 @@ func TimeToValue(time time.Time) string {
|
||||
}
|
||||
|
||||
func MoneyCentsToString(money int, currency string, lang Language) string {
|
||||
beforeDecimals := money / 100
|
||||
afterDecimals := money % 100
|
||||
if lang == De {
|
||||
return fmt.Sprintf("%,2f %s", money, currency)
|
||||
return fmt.Sprintf("%d,%d %s", beforeDecimals, afterDecimals, currency)
|
||||
}
|
||||
return fmt.Sprintf("%s%.2f", currency, money)
|
||||
return fmt.Sprintf("%s%d.%d", currency, beforeDecimals, afterDecimals)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user