Question
How period is calculated when MONTHDIFF_ALG_ACTUALDAYS algorithm is used?
Answer
A parameter MonthDiff is calculated - how many months between a month of the start date and a month of the end date
MonthDiff = [month number of end date] - [month number of start date]
for example, upgrade order was placed on June, 20 (start date), subscription next billing date is Aug, 15 (end date), then
MonthDiff = 8 - 6 = 2
A parameter restDays is calculated - how many days left from the start date till the end of month
restDays = [number of days in month of start date] - [exact day of start date] + 1
based on the dates from an example in the step 1:
restDays = 30 - 20 + 1 = 11
A parameter fractMonthStart is calculated - a part of month from the start date till the end of month
fractMonthStart = restDays/[number of days in month of start date]
based on the dates from an example in the step 1:
fractMonthStart = 11/30 ~ 0.3667
A parameter fractMonthEnd is calculated - a part of month from the beginning of a month for the end date till the end date
fractMonthEnd = ([exact date of end date] - 1)/[number of days in month of end date]
for the end date Aug, 15
fractMonthEnd = (15 - 1)/31 = 14/31 ~ 0,4516
A parameter diffInMonths is calculated - a period between the start and the end dates
diffInMonths = MonthDiff + fractMonthStart + fractMonthEnd - 1
diffInMonths = 2 + 0.3667 + 0,4516 - 1 = 1,8183 ~ 1,82 , so as a result the client will be billed for 1,82 month.
Additional information
The MONTHDIFF_ALG_ACTUALDAYS algorithm is just one of the algorithms a provider can choose to calculate the number of days to be used for proration. To learn about other algorithms and how to switch between them please refer to https://kb.cloudblue.com/en/116095.