Closed MostafaRDE closed 5 years ago
`Assertion::greaterOrEqualThan($months, 1);
$years = (int) ($months / 12); $date = $years > 0 ? $this->addYears($years) : clone $this; $months = ($months % 12) + $date->getMonth(); $days = 0; for ($i = $date->getMonth() + 1; $i <= $months; $i++) { $days += $date->getDaysOf($i); **// Bug here** if ($i === 12) { $i = 1; $months = $months - 12; } } return $date->addDays($days);`
Sometimes maybe month is 12, so when month total with 1 digit, reporting exception: Provided "13" is neither greater than or equal to "1" nor less than or equal to "12".
I faced with this problem too!
This issue fixed at v3.0.12
v3.0.12
`Assertion::greaterOrEqualThan($months, 1);
Sometimes maybe month is 12, so when month total with 1 digit, reporting exception: Provided "13" is neither greater than or equal to "1" nor less than or equal to "12".