diff --git a/src/components/calculator.tsx b/src/components/calculator.tsx index c657d2d..79e28c1 100644 --- a/src/components/calculator.tsx +++ b/src/components/calculator.tsx @@ -5,8 +5,10 @@ const MAX_PEOPLE = 3000; const BOTTLE_CENTILITERS = 150; const SLICES_PER_PIZZA = 8; +const formatNumber = (value: number) => value.toLocaleString("nb-NO"); + const calculateLiters = (people: number, thirstiness: number) => { - return Math.ceil((people * thirstiness) / 100); + return Math.ceil((people * thirstiness) / 10) / 10; }; const calculateBottles = (people: number, thirstiness: number) => { @@ -76,14 +78,14 @@ const Calculator = () => {
- {calculateLiters(people, thirstiness)} + {formatNumber(calculateLiters(people, thirstiness))} {" "} liter
eller
- {calculateBottles(people, thirstiness)} + {formatNumber(calculateBottles(people, thirstiness))} {" "} flasker (1,5L)
@@ -91,14 +93,14 @@ const Calculator = () => {- {calculatePizzaSlices(people, hungriness)} + {formatNumber(calculatePizzaSlices(people, hungriness))} {" "} pizzastykker
eller
- {calculatePizzas(people, hungriness)} + {formatNumber(calculatePizzas(people, hungriness))} {" "} store pizzaer