From 905092356aa75993f3c5bf70e2276b27c3ebef5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivar=20Conradi=20=C3=98sthus?= Date: Wed, 16 Oct 2024 21:00:20 +0200 Subject: [PATCH] fix: traffic estimate should Math.floor price estimate to full million --- frontend/src/hooks/useTrafficData.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/hooks/useTrafficData.ts b/frontend/src/hooks/useTrafficData.ts index bbd7b74ef635..20aaf30153bb 100644 --- a/frontend/src/hooks/useTrafficData.ts +++ b/frontend/src/hooks/useTrafficData.ts @@ -172,7 +172,8 @@ export const calculateOverageCost = ( return 0; } - const overage = dataUsage - includedTraffic; + const overage = + Math.floor((dataUsage - includedTraffic) / 1_000_000) * 1_000_000; return overage > 0 ? calculateTrafficDataCost(overage) : 0; };