'Carbon - Float Difference in Months Filtered

I'd like to perform this operation (filtering out weekends), but have the result returned in float months:

$weekdiff = ($carbonFrom->diffInDaysFiltered(function(Carbon $date) {
return !$date->isWeekend();
                }, $carbonTo) + 1) / 5;

Is there a way to get the float difference in months between two dates while filtering out weekends?

Thank you!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source