const DEFAULT_BILLING_PERIOD_DAYS = 30; export function calculateProratedUpgradeAmount( currentPlanPrice: number, requestedPlanPrice: number, remainingDays: number, billingPeriodDays = DEFAULT_BILLING_PERIOD_DAYS ): number { const dailyDifference = (requestedPlanPrice - currentPlanPrice) / billingPeriodDays; return Math.round(dailyDifference * remainingDays * 100) / 100; }