1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-26 13:48:33 +02:00

fix: solve 31 day month issue by using trafficUnitSize and not constant 1_000_000 (#9404)

This commit is contained in:
David Leek 2025-03-03 11:16:48 +01:00 committed by GitHub
parent 3fa5ac008b
commit 90fe02ed0d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -94,7 +94,8 @@ export const calculateOverageCost = (
}
const overage =
Math.floor((dataUsage - includedTraffic) / 1_000_000) * 1_000_000;
Math.floor((dataUsage - includedTraffic) / trafficUnitSize) *
trafficUnitSize;
return overage > 0
? calculateTrafficDataCost(overage, trafficUnitCost, trafficUnitSize)
: 0;