diff --git a/backend/app/Helper/Currency.php b/backend/app/Helper/Currency.php index 375fe148..55883513 100644 --- a/backend/app/Helper/Currency.php +++ b/backend/app/Helper/Currency.php @@ -15,10 +15,18 @@ public static function format(float|int $amount, string $currencyCode, string $l public static function round(float $value, $precision = 2): float { - return round( - num: $value, - precision: $precision, - mode: PHP_ROUND_HALF_UP - ); + $fraction = $value - floor($value); + + if ($fraction >= 0.99) { + return ceil($value); + } elseif ($fraction <= 0.01) { + return floor($value); + } else { + return round( + num: $value, + precision: $precision, + mode: PHP_ROUND_HALF_UP + ); + } } } diff --git a/frontend/src/utilites/currency.ts b/frontend/src/utilites/currency.ts index 1f78afe1..143f0829 100644 --- a/frontend/src/utilites/currency.ts +++ b/frontend/src/utilites/currency.ts @@ -1,5 +1,5 @@ export const formatCurrency = (value: number | string, currency = 'USD') => { - const formatter = new Intl.NumberFormat('en-US', { + const formatter = new Intl.NumberFormat('de-DE', { style: 'currency', currency: currency, minimumFractionDigits: 2,