fix bug add months

This commit is contained in:
Nasser committed 2018-07-22 15:04:43 +04:30
1 parent 9ee4cd2a6c
commit 67d9b3e4ec
1 file changed
+3 -4
+3 -4
View File
@@ -2200,13 +2200,12 @@ class Verta extends DateTime {
$year += intval($month / 12) - 1;
$month = 12 + ($month % 12);
}
if ($value > 0) {
if (($month > 6 && $day == 31) || ($month == 12 && $day == 30 && !self::isLeapYear($year))) {
if (($month > 6 && $month < 12 && $day == 31)) {
$day--;
}
}
else {
if (($month == 12 && $day == 31) || ($month == 12 && $day == 30)) {
if ($month == 12 && ($day == 30 || $day == 31)) {
$day = self::isLeapYear($year) ? 30 : 29;
}
}